I'm new in C#. I have a text file containing:
[False False False]
[ True False False]
[ True False False]
How can I write a function that print on console something like if the line is "[False False False]" it prints be 0, if the line is [ True False False] it prints 1, so it will be 0 1 1 line by line. I've already read the text file and printed it line by line to console by the function:
public static void PrintData()
{
using (var readtext = new StreamReader(@"E:\text.txt"))
{
while (!readtext.EndOfStream)
{
string[] lines = File.ReadAllLines(@"E:\text.txt");
foreach (string line in lines)
Console.WriteLine(line);
}
}
}
Aucun commentaire:
Enregistrer un commentaire