另一种方法是创建一个静态类:public static class AgeGroup{ public static class TeenAge { public static readonly int FromAge = 16; public static readonly int ToAge = 17; } public static class YoungAge { public static readonly int FromAge = 18; public static readonly int ToAge = 21; }}现在,您可以引用该变量,如下所示:int teenAgeStarting = AgeGroup.TeenAge.FromAge //16int youngAgeStarting = AgeGroup.YoungAge.FromAge //18