Here's my code so far:
public void DeserialStream(string filePath)
{
using (StreamReader sr = new StreamReader(filePath))
{
string currentline;
while ((currentline = sr.ReadLine()) != null)
{
if (currentline.IndexOf("Count", StringComparison.CurrentCultureIgnoreCase) >= 0)
{
Console.WriteLine(currentline);
}
}
}
}
I was wondering how can I grab comma delimited values that appear after a term I searched for?
Like if I a csv that contained this info:
"Date","dd/mm/yyyy"
"ExpirationDate","dd/mm/yyyy"
"DataType","Count"
"Location","Unknown","Variable1","Variable2","Variable3"
"A(Loc3, Loc4)","Unknown","5656","787","42"
"A(Loc5, Loc6)","Unknown","25","878","921"
"DataType","Net"
"Location","Unknown","Variable1","Variable2","Variable3"
"A(Loc3, Loc4)","Unknown","5656","787","42"
"A(Loc5, Loc6)","Unknown","25","878","921"
But how would I grab the table of values after Count but before Net?
That is, only the data is brackets is what I want to parse:
"Date","dd/mm/yyyy"
"ExpirationDate","dd/mm/yyyy"
"DataType","Count"
[ "Location","Unknown","Variable1","Variable2","Variable3"
"A(Loc3, Loc4)","Unknown","5656","787","42"
"A(Loc5, Loc6)","Unknown","25","878","921"]
"DataType","Net"
"Location","Unknown","Variable1","Variable2","Variable3"
"A(Loc3, Loc4)","Unknown","5656","787","42"
"A(Loc5, Loc6)","Unknown","25","878","921"
I was thinking maybe I should use a regular expression or is there an easier way using the method above?