private void GenerateCS() { IMemberOperatorGenerator gen = null; switch (Operator) { case OperatorType.Explicit: gen = new ExplicitOperatorGeneratorCS(); break; case OperatorType.Implicit: gen = new ImplicitOperatorGeneratorCS(); break; default: throw new NotImplementedException(string.Format("Какая-то несанкционированная xуйня")); } using (Microsoft.CSharp.CSharpCodeProvider provider = new Microsoft.CSharp.CSharpCodeProvider()) { System.CodeDom.Compiler.CodeGeneratorOptions opts = new System.CodeDom.Compiler.CodeGeneratorOptions(); using (System.CodeDom.Compiler.IndentedTextWriter tw = new System.CodeDom.Compiler.IndentedTextWriter(new StringWriter(), opts.IndentString)) { gen.GenerateDeclaration(tw, provider, opts, ReturnType, Parameters); tw.WriteLine("{"); tw.Indent++; gen.GenerateStatemets(tw, provider, opts, Statements); tw.Indent--; tw.WriteLine("}"); Text = tw.InnerWriter.ToString(); } } }