I want to read data from specific path but i the program read the first line only.
my program gets data from user and save it int .txt file then i want to display all contents in between the delimiters.
input
1@aaa@bbbb@2@c@f@3@r@t
output
Id:1
Name:aaa
Address:bbbb
Id:2
Name:c
Address:f
Id:3
Name:r
Address:t
here is my code:
main
FileStream fs = new FileStream(@"E:\New folder\a ", FileMode.Open);
StreamReader sd = new StreamReader(fs);
string s;
while (true)
{
s = sd.ReadLine();
field = s.Split(std.delimiter);
std.ID = field[0];
std.Name = field[1];
std.Address = field[2];
std.Display_data();
sd.Close();
fs.Close();
break;
}
class
public void Display_data()
{
Console.WriteLine(ID);
Console.WriteLine(Name);
Console.WriteLine(Address);
}