|
List Info
Thread: First "real" C# application
|
|
| First "real" C# application |

|
2006-12-20 15:02:37 |
I'm coming from a fairly strong Java background and I've
decided to
start writing a C# application using Visual Studio 2005. My
first
impressions are, WOW... what have I been thinking trying to
do
client-side apps in Java!? Anyway, each tool has it's place
I guess...
but now to my question:
I'm writing an app that converts form posted emails, stored
in
individual text files, in the form of:
Name: Joe Blow
Address: 1234 Address Lane
Email: test test.com
And I want to convert the file into a CSV... the problem is
that I
don't know all of the fields until after going through the
text and the
number of files is not-finite, so I can't begin to write the
CSV output
as I parse through the files... here was my plan, pass over
the files
once, first, to obtain the field names, and then pass
through them
again to write the CSV file. I'm fairly confident I could
accomplish
this without requiring a lot of memory but then it seems
inefficient to
pass through the file twice... once to gather the field
names, and then
a second time to write the output file... any ideas? I don't
want to
create a memory hog application that stores the strings in
memory...
Thanks,
Cliff.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "DotNetDevelopment, VB.NET, C# .NET,
ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting"
group.
To post to this group, send email to DotNetDevelopment googlegroups.com
To unsubscribe from this group, send email to
DotNetDevelopment-unsubscribe googlegroups.com
For more options, visit this group at
http:
//cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---
|
|
| First "real" C# application |

|
2006-12-21 13:26:18 |
Cliff, welcome to the wonderful world of .NET !!
If I understand you correctly, you cannot write to the CSV
target until
you're done reading all the files because you wouldn't get
an idea
about the no. of possible columns till that time.
In my opinion, you seem to be doing this the right way.
Theoretically
you could parse the files only one time, and read the no. of
columns
and their respective values into a two dimensional
collection (that you
would need to keep resizing as you find more columns), but
that would
probably be much more complicated than parsing the files
once to get a
total no. of columns. Then constructing a DataTable with
those columns
and filling the values by parsing the files again.
But I'm sure someone has a better answer.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "DotNetDevelopment, VB.NET, C# .NET,
ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting"
group.
To post to this group, send email to DotNetDevelopment googlegroups.com
To unsubscribe from this group, send email to
DotNetDevelopment-unsubscribe googlegroups.com
For more options, visit this group at
http:
//cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---
|
|
| First "real" C# application |

|
2006-12-21 13:33:40 |
Ok, I was wrong, and I'm thankful that it is I'm the one
correcting
myself ! :P
I was unsure about this but I just tested it,and you CAN add
columns to
a DataTable AFTER you've populated rows. This means that you
need to
parse your files only once, and keep adding columns and data
at the
same time.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "DotNetDevelopment, VB.NET, C# .NET,
ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting"
group.
To post to this group, send email to DotNetDevelopment googlegroups.com
To unsubscribe from this group, send email to
DotNetDevelopment-unsubscribe googlegroups.com
For more options, visit this group at
http:
//cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---
|
|
| First "real" C# application |

|
2006-12-23 15:35:04 |
Excellent. I will take a look at the DataTable class... I
actually got
the program working in a two pass mode... but a single pass
would be
much more desirable.
Thanks for your assistance.
Cliff.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "DotNetDevelopment, VB.NET, C# .NET,
ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting"
group.
To post to this group, send email to DotNetDevelopment googlegroups.com
To unsubscribe from this group, send email to
DotNetDevelopment-unsubscribe googlegroups.com
For more options, visit this group at
http:
//cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---
|
|
| First "real" C# application |

|
2006-12-28 10:54:32 |
Most welcome. Lemme know if you need more help on this.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "DotNetDevelopment, VB.NET, C# .NET,
ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting"
group.
To post to this group, send email to DotNetDevelopment googlegroups.com
To unsubscribe from this group, send email to
DotNetDevelopment-unsubscribe googlegroups.com
For more options, visit this group at
http:
//cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---
|
|
[1-5]
|
|