public  class  ServiceUrl {
            static public readonly login = "http://localhost/think/index.php/Index/login",
            static public readonly softlist = "http://localhost/think/index.php/Index/softlist"
        }这样写
用s = ServiceUrl.login; 调用

解决方案 »

  1.   

    你这个枚举里面的值默认是int类型的,你要显式说明一下吧
      

  2.   

    enum 就是number型啊
    用struct吧,里面可以放各种类型
      

  3.   

    C#里枚举只能将value类型定义为: byte,sbyte,short,ushort,int,uint,long,ulong
      

  4.   

    不用定义类也可以的        public struct Debug//程序调试信息
            {
                public static string PLCIP = string.Empty;
                public static string DataCon1 = string.Empty;            public static bool[] ConSuccess = new bool[2];
                public static uint[] SuccessesCount = new uint[2];
                public static uint[] FailsCount = new uint[2];
                public static bool DBFail = false;            public static string DBResult = string.Empty;            public static bool[] PortOK = new bool[4];            public static int[] TestCount = new int[4];//线程运行计数
                public static int[] ReadCount1 = new int[4];//串口通信计数
                public static int[] ReadCount2 = new int[4];//串口数据计数
                public static int[] ReadCount2_old = new int[4];//串口数据计数old
                public static int[] ReadCount_delay = new int[4];//串口数据延迟计数
            }调用方法就是Debug.PLCIP,这样.里面放什么都行.
    仅仅是将变量封装了起来,不要求类型
      

  5.   

    表示之前我也想这样来着,后来专门查了一下枚举,发现不行,就用了类        private static class ModuleShapeXmlName
            {
                public const string CylinderName = "柱体";
                public const string ConeName = "锥体";
                public const string CubeName = "立方体";
            }