System.CodeDom.Tests.CSharpCodeGenerationTests.ClassWithStaticFields C# (CSharp) Method

ClassWithStaticFields() private method

private ClassWithStaticFields ( ) : void
return void
        public void ClassWithStaticFields()
        {
            var cd = new CodeTypeDeclaration("SomeClass") { IsClass = true };
            cd.Members.Add(new CodeMemberField(typeof(int), "s_privateNumber") { Attributes = MemberAttributes.Private | MemberAttributes.Static });
            cd.Members.Add(new CodeMemberField(typeof(string), "s_internalString") { Attributes = MemberAttributes.Assembly | MemberAttributes.Static });
            cd.Members.Add(new CodeMemberField(typeof(DateTime), "s_protectedDateTime") { Attributes = MemberAttributes.Family | MemberAttributes.Static });
            cd.Members.Add(new CodeMemberField(typeof(TimeSpan), "PublicTimeSpan") { Attributes = MemberAttributes.Public | MemberAttributes.Static });
            cd.Members.Add(new CodeMemberField(typeof(Guid), "s_protectedInternalGuid") { Attributes = MemberAttributes.FamilyOrAssembly | MemberAttributes.Static });

            AssertEqual(cd,
                @"public class SomeClass {
                      private static int s_privateNumber;
                      internal static string s_internalString;
                      protected static System.DateTime s_protectedDateTime;
                      public static System.TimeSpan PublicTimeSpan;
                      protected internal static System.Guid s_protectedInternalGuid;
                  }");
        }