retrive file line one by one using C#?
- by riad
Dear all,
I have a file name abc.txt.On that file have some lines like this:
jani
50,south carolina,USA
karim
16,roam,Italy
fara
52,sydny,Australia
first line is name and second line is address.Now i need the info name on a string let say nameString and address is let say addressString.How can i do it using C#?
I write a code in PHP its working smoothly.I need the same thing in C#.For yours clarification here is the php code:
$file=file_get_contents('abc.txt');
$arr=explode("\n",$file);
for ($i=0;$i<count($arr);$i=$i+2)
{
$name=$arr[$i];
$address=$arr[$i+1];
echo $name ."<br/>";
echo $address. "<br/>";
}
How can i do the same thing in C#????
Another question: IS their any function in C# as like as explode in php?
thanks in advance
riad