예제 #1
0
 public void PrintCode(CodeWriter cp)
 {
     cp.BeginLine();
     foreach (CodeCustomAttribute a in customAttributes)
     {
         a.PrintCode(cp);
     }
     cp.BeginLine();
     if (IsStatic)
     {
         cp.Write("static ");
     }
     if (IsPublic)
     {
         cp.Write("public ");
     }
     if (returnType != null)
     {
         cp.Write(returnType + " ");
     }
     cp.Write(name);
     if (parameterTypes.Length > 0)
     {
         cp.Write(name + " [");
         for (int n = 0; n < parameterTypes.Length; n++)
         {
             if (n > 0)
             {
                 cp.Write(", ");
             }
             cp.Write(parameterTypes[n] + " arg" + n);
         }
         cp.Write("]");
     }
     cp.Write(" {");
     cp.EndLine();
     cp.Indent();
     cp.WriteLineInd("get {");
     get_builder.PrintCode(cp);
     cp.WriteLineUnind("}");
     cp.WriteLine("set {");
     set_builder.PrintCode(cp);
     cp.WriteLine("}");
     cp.WriteLineUnind("}");
 }
예제 #2
0
        public virtual void PrintCode(CodeWriter cp)
        {
            cp.BeginLine();
            foreach (CodeCustomAttribute a in customAttributes)
            {
                a.PrintCode(cp);
            }
            if ((methodBase.Attributes & MethodAttributes.Static) != 0)
            {
                cp.Write("static ");
            }
            if ((methodBase.Attributes & MethodAttributes.Public) != 0)
            {
                cp.Write("public ");
            }
            if (returnType != null)
            {
                cp.Write(returnType + " ");
            }
            cp.Write(name + " (");
            for (int n = 0; n < parameterTypes.Length; n++)
            {
                if (n > 0)
                {
                    cp.Write(", ");
                }
                cp.Write(parameterTypes[n] + " arg" + n);
            }
            cp.Write(")");
            cp.EndLine();
            cp.WriteLineInd("{");

            builder.PrintCode(cp);

            cp.WriteLineUnind("}");
        }