C# error: Use of unassigned local variable

前端 未结 4 1996
庸人自扰
庸人自扰 2020-12-03 16:43

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 stat         


        
4条回答
  •  孤街浪徒
    2020-12-03 17:32

    The compiler only knows that the code is or isn't reachable if you use "return". Think of Environment.Exit() as a function that you call, and the compiler don't know that it will close the application.

提交回复
热议问题