static void Main()
{
string str;
str = Console.ReadLine();
while (str != null)//HERE!
{
str = str.Remove(0, 1);
str = str.Remove(str.Length - 1, 1);
string[] value = str.Split(',');
int[] intval = new int[value.Length];
for (int i = 0; i < value.Length; ++i)
{
bool re = int.TryParse(value[i], out intval[i]);
Console.WriteLine(intval[i]);
}
str = Console.ReadLine();
}
}
Hi, in the program above, I want to judge whether there is stuff not read in the console using "str!=null".
However,the ReadLine() returned a "" to me instead of a null, and the program can get into the while loop and generate a wrong result.
How can I fix it?