AddConstructor() публичный Метод

public AddConstructor ( ) : Constructor
Результат NClass.Core.Constructor
Пример #1
0
        static CSharpLanguage()
        {
            // objectClass initialization
            string[] objectMethods =
            {
                "public static bool Equals(object objA, object objB)",
                "public virtual bool Equals(object obj)",
                "public virtual int GetHashCode()",
                "public System.Type GetType()",
                "protected object MemberwiseClone()",
                "public static bool ReferenceEquals(object objA, object objB)",
                "public virtual string ToString()"
            };
            objectClass = new CSharpClass("Object");
            objectClass.AddConstructor();
            foreach (string methodDeclaration in objectMethods)
            {
                objectClass.AddMethod().InitFromString(methodDeclaration);
            }

            // validAccessModifiers initialization
            validAccessModifiers = new Dictionary <AccessModifier, string>(6);
            validAccessModifiers.Add(AccessModifier.Default, "Default");
            validAccessModifiers.Add(AccessModifier.Public, "Public");
            validAccessModifiers.Add(AccessModifier.ProtectedInternal, "Protected Internal");
            validAccessModifiers.Add(AccessModifier.Internal, "Internal");
            validAccessModifiers.Add(AccessModifier.Protected, "Protected");
            validAccessModifiers.Add(AccessModifier.Private, "Private");

            // validClassModifiers initialization
            validClassModifiers = new Dictionary <ClassModifier, string>(3);
            validClassModifiers.Add(ClassModifier.Abstract, "Abstract");
            validClassModifiers.Add(ClassModifier.Sealed, "Sealed");
            validClassModifiers.Add(ClassModifier.Static, "Static");

            // validFieldModifiers initialization
            validFieldModifiers = new Dictionary <FieldModifier, string>(5);
            validFieldModifiers.Add(FieldModifier.Static, "Static");
            validFieldModifiers.Add(FieldModifier.Readonly, "Readonly");
            validFieldModifiers.Add(FieldModifier.Constant, "Const");
            validFieldModifiers.Add(FieldModifier.Hider, "New");
            validFieldModifiers.Add(FieldModifier.Volatile, "Volatile");

            // validOperationModifiers initialization
            validOperationModifiers = new Dictionary <OperationModifier, string>(8);
            validOperationModifiers.Add(OperationModifier.Static, "Static");
            validOperationModifiers.Add(OperationModifier.Hider, "New");
            validOperationModifiers.Add(OperationModifier.Virtual, "Virtual");
            validOperationModifiers.Add(OperationModifier.Abstract, "Abstract");
            validOperationModifiers.Add(OperationModifier.Override, "Override");
            validOperationModifiers.Add(OperationModifier.Sealed, "Sealed");
            validOperationModifiers.Add(OperationModifier.Sealed | OperationModifier.Override,
                                        "Sealed Override");
            validOperationModifiers.Add(OperationModifier.Abstract | OperationModifier.Override,
                                        "Abstract Override");
        }
Пример #2
0
 static CSharpLanguage()
 {
     // objectClass initialization
     ObjectClass = new CSharpClass("Object");
     ObjectClass.AddConstructor();
     string[] objectMethods =
     {
         "public static bool Equals(object objA, object objB)",
         "public virtual bool Equals(object obj)",
         "public virtual int GetHashCode()",
         "public System.Type GetType()",
         "protected object MemberwiseClone()",
         "public static bool ReferenceEquals(object objA, object objB)",
         "public virtual string ToString()"
     };
     foreach (string methodDeclaration in objectMethods)
     {
         ObjectClass.AddMethod().InitFromString(methodDeclaration);
     }
 }
Пример #3
0
		static CSharpLanguage()
		{
			// objectClass initialization
			string[] objectMethods = {
				"public static bool Equals(object objA, object objB)",
				"public virtual bool Equals(object obj)",
				"public virtual int GetHashCode()",
				"public System.Type GetType()",
				"protected object MemberwiseClone()",
				"public static bool ReferenceEquals(object objA, object objB)",
				"public virtual string ToString()"
			};
			objectClass = new CSharpClass("Object");
			objectClass.AddConstructor();
			foreach (string methodDeclaration in objectMethods)
				objectClass.AddMethod().InitFromString(methodDeclaration);

			// validAccessModifiers initialization
			validAccessModifiers = new Dictionary<AccessModifier, string>(6);
			validAccessModifiers.Add(AccessModifier.Default, "Default");
			validAccessModifiers.Add(AccessModifier.Public, "Public");
			validAccessModifiers.Add(AccessModifier.ProtectedInternal, "Protected Internal");
			validAccessModifiers.Add(AccessModifier.Internal, "Internal");
			validAccessModifiers.Add(AccessModifier.Protected, "Protected");
			validAccessModifiers.Add(AccessModifier.Private, "Private");

			// validClassModifiers initialization
			validClassModifiers = new Dictionary<ClassModifier, string>(3);
			validClassModifiers.Add(ClassModifier.Abstract, "Abstract");
			validClassModifiers.Add(ClassModifier.Sealed, "Sealed");
			validClassModifiers.Add(ClassModifier.Static, "Static");

			// validFieldModifiers initialization
			validFieldModifiers = new Dictionary<FieldModifier, string>(5);
			validFieldModifiers.Add(FieldModifier.Static, "Static");
			validFieldModifiers.Add(FieldModifier.Readonly, "Readonly");
			validFieldModifiers.Add(FieldModifier.Constant, "Const");
			validFieldModifiers.Add(FieldModifier.Hider, "New");
			validFieldModifiers.Add(FieldModifier.Volatile, "Volatile");

			// validOperationModifiers initialization
			validOperationModifiers = new Dictionary<OperationModifier, string>(8);
			validOperationModifiers.Add(OperationModifier.Static, "Static");
			validOperationModifiers.Add(OperationModifier.Hider, "New");
			validOperationModifiers.Add(OperationModifier.Virtual, "Virtual");
			validOperationModifiers.Add(OperationModifier.Abstract, "Abstract");
			validOperationModifiers.Add(OperationModifier.Override, "Override");
			validOperationModifiers.Add(OperationModifier.Sealed, "Sealed");
			validOperationModifiers.Add(OperationModifier.Sealed | OperationModifier.Override,
				"Sealed Override");
			validOperationModifiers.Add(OperationModifier.Abstract | OperationModifier.Override,
				"Abstract Override");
		}