I was trying to create an array, using a .txt file in which there are words. Only one word per array. But down there, the fajlbe.ReadLine();
is pinned as wrong code. Why?
struct Sor
{
public string árucikk;
}
static Sor[] TSor = new Sor[1000];
static void Main(string[] args)
{
StreamReader fajlbe = new StreamReader("penztar.txt");
string[] tomb = new String[1];
int n = 0;
while(!fajlbe.EndOfStream)
{
tomb = fajlbe.ReadLine(); //here I've got an error
TSor[n].árucikk = tomb[0];
n++;
}
Console.WriteLine(TSor[1]);
fajlbe.Close();