consulo-csharp icon indicating copy to clipboard operation
consulo-csharp copied to clipboard

No error inside array initializer with explicit type

Open VISTALL opened this issue 8 years ago • 0 comments

Error:

Cannot implicitly convert type 'dsadas.DA' to 'short'. An explicit conversion exists (are you missing a cast?)(CS0266)

Code:

    public enum DA {
        STRING,
        STRING2
    }

    public class EnumError {
        public void test() {
            short[] array = new short[]{DA.STRING, DA.STRING2};

        }
    }

VISTALL avatar Jan 26 '18 15:01 VISTALL