Click here to Skip to main content
15,906,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello I have string arrays in a file that have to read it and display in the datagrid in wpf.

The text file has array vaues like
{{name}, {name2}, {name3}}
{{tom}, {John}, {Harry}}

I tried following but it didnt work because it is expecting regular txt file instead of the arrays
string[] str = File.ReadAllLines("filepath");

in my case I have to read arrays from the file instead of simple text
how to do it best?

Thanks
Posted

1 solution

May I suggest using Regular Expressions?
http://msdn.microsoft.com/en-us/library/ms228595(v=vs.80).aspx[^]

You can also write your own code, but I feel like you might not be understanding what File.ReadAllLines("filepath"); is actually doing. That function won't parse based on values, just read all the text from each line.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900