现在我能使用codeDom来生成一个简单的类,例如:
Public Class A
Public Function B()
End Class现在我希望生成的这个类继承自一个接口,并且实现其中的方法:
Public Class A
Implements IDataPublic Function B() implements IData.B
End Class但是我找不到生成“Implements“接口语句的方法,我试了往CodeTypeDeclaration.BaseTypes添加写东西,但他这能帮我生成“Inherits”语句。请知道怎样实现的人给些建议?谢谢

解决方案 »

  1.   

    IP IC IQ卡,统统给我,呵呵http://community.csdn.net/Expert/topic/4432/4432868.xml?temp=.3879053
      

  2.   

    using System;
    using System.CodeDom;
    using System.CodeDom.Compiler;
    using Microsoft.VisualBasic;
    public class Test
    {
      public static void Main()
      {
    CodeTypeDeclaration c = new CodeTypeDeclaration("Test");
    c.BaseTypes.Add(typeof(ICloneable));
    CodeDomProvider p = new VBCodeProvider();
    ICodeGenerator g = p.CreateGenerator();
    g.GenerateCodeFromType(c, Console.Out, null);
      }
    }