I'm not sure why I'm getting this error, but shouldn't this code compile, since I'm already checking to see if queue is getting initialized?
public static void Main(String[] args)
{
Byte maxSize;
Queue queue;
if(args.Length != 0)
{
if(Byte.TryParse(args[0], out maxSize))
queue = new Queue(){MaxSize = maxSize};
else
Environment.Exit(0);
}
else
{
Environment.Exit(0);
}
for(Byte j = 0; j < queue.MaxSize; j++)
queue.Insert(j);
for(Byte j = 0; j < queue.MaxSize; j++)
Console.WriteLine(queue.Remove());
}
So if queue is not initialized, then the for loops aren't reachable right? Since the program already terminates with Environment.Exit(0)?
Hope ya'll can give me some pointers :)
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…