如题!如果不能该怎么做呢?         string STDT_READ_MSG = "02";//学生卡读取留言
         string CALL_BILLING = "03";//通话话单

解决方案 »

  1.   

    可以用readonly
    public readonly string STDT_READ_MSG = "02";//学生卡读取留言
    public readonly string CALL_BILLING = "03";//通话话单
      

  2.   

    能不能用一个struct呀不知所云
      

  3.   

    public static class/* struct */ Strings{
       public const string Value = "aa";}
      

  4.   

    枚举值只能是数字,但ToString()可以是字符串。
      

  5.   


    struct是结构体不是枚举哦.定义枚举可以用字符串啊.但他本来的值却是数字
      

  6.   

    楼主想把一些常量做成强类型吧?比如下面的:        public struct CustomDefine
            {
                public static readonly string hahaTest = "hahaTest";            public struct CustomComm
                {
                    public static readonly string NewLine = System.Environment.NewLine;                public static readonly string Dot = ".";
                }            public struct URLConst
                {
                    public static  readonly string HttpPrefx= "http";                public static readonly string HttpsPrefx = "https";
                }
            }
      

  7.   

    引用时
    只要
                //取haha
                string haha =  CustomDefine.hahaTest;
                //结构中包含结构NewLine
               string hahaNewLine= CustomDefine.CustomComm.NewLine;
      

  8.   

    枚举是值类型、string是引用类型,类型之间可以互相转换,
    但是用string定义枚举不行吧!