Return Enum From C# Property getters

前端 未结 7 958
谎友^
谎友^ 2021-01-21 14:35

How do you return an Enum from a setter/getter function?

Currently I have this:

    public enum LowerCase
    {
        a,
        b,
    }
    public en         


        
7条回答
  •  灰色年华
    2021-01-21 14:49

    That error is being thrown because LowerCase is a type. Imagine if you were trying to write this statement.

    return Int32;
    

    That would not work because Int32 is a type and not a variable. You will need to create an instance of LowerCase and then you can return it.

提交回复
热议问题