AddMethod() public method

/// The does not fit to the syntax. ///
public AddMethod ( ) : Method
return NClass.Core.Method
Ejemplo n.º 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");
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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");
		}