Use of unassigned variable?

前端 未结 5 998
Happy的楠姐
Happy的楠姐 2021-01-26 19:04

I\'m getting the error use of unassigned variable \"ps\" when declaring if paymentstatus is null or has value in the \"if\" statement. I\'m thinking that i allready declared ps

5条回答
  •  伪装坚强ぢ
    2021-01-26 19:37

    Initialize your ps variable like

    PaymentStatus? ps = null; //or something. 
    

    From Compiler Error CS0165

    C# compiler does not allow the use of uninitialized variables. If the compiler detects the use of a variable that might not have been initialized, it generates compiler error CS0165

提交回复
热议问题