C#: Use of unassigned local variable, using a foreach and if

前端 未结 6 1002
说谎
说谎 2020-11-30 14:19

I have this following code:
I get the error, \"Use of un-Assigned Local variable\" I\'m sure this is dead simple, but im baffled..

    public string ret         


        
6条回答
  •  感情败类
    2020-11-30 15:09

    This can happen for all variable types as well.

    For collections and objects, initialize using new.

    eg. List result = new List();

提交回复
热议问题