enum和struct的用法-----c#

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了enum和struct的用法-----c#相关的知识,希望对你有一定的参考价值。

 public struct Color1
    {
        public const int Blue = 1;
        public const int Green = 2;
        public static int Yellow = 3;
    }

    public enum Color2:int
    {
       Blue=1,
       Green=2
    }
MessageBox.Show(Color1.Blue.ToString("D"));//转换成数字显示
            MessageBox.Show(Color2.Blue.ToString("D"));//转换成数字显示

 

以上是关于enum和struct的用法-----c#的主要内容,如果未能解决你的问题,请参考以下文章