Disable/suppress warning CS0649 in C# for a specific field of class

前端 未结 5 2071
春和景丽
春和景丽 2020-12-18 17:54

I have some fields in a C# class which I initialize using reflection. The compiler shows CS0649 warning for them:

Field foo\' is never assigned

5条回答
  •  生来不讨喜
    2020-12-18 18:15

    public class YouClass
    {
    #pragma warning disable 649
        string foo;
    #pragma warning restore 649
    }
    

提交回复
热议问题