private void GenerateEnums() { CodeCreate oCodeCreate = new CodeCreate(); oCodeCreate.CreateNamespaceAndClass("CodeDOM", "MyClass", TypeAttributes.Public | TypeAttributes.Abstract); List <string> oList = new List <string>(); oList.Add("Car"); oList.Add("Bus"); oList.Add("Limo"); oList.Add("Tank"); oCodeCreate.AddEnum("Vehicles", oList); oCodeCreate.GenerateCode(@"c:\temp\SampleCode.cs", "CSharp"); }
private void GenerateCode() { CodeCreate oCodeCreate = new CodeCreate(); oCodeCreate.CreateNamespaceAndClass("CodeDOM", "MyClass", TypeAttributes.Public | TypeAttributes.Abstract); oCodeCreate.AddConstructor(); oCodeCreate.AddField(MemberAttributes.Private, "_szCustomerName", "Name of the customer", "System.String"); oCodeCreate.AddField(MemberAttributes.Private, "_iSalesRepID", "Primary key ID of sales rep", "System.Int32"); oCodeCreate.AddProperty(MemberAttributes.Public | MemberAttributes.Final, "CustomerName", "Comment goes here", "System.String", true, true, "_szCustomerName"); oCodeCreate.AddMethod(MemberAttributes.Public, "DeleteCustomer", "Executes SQL that deletes a customer", "System.Void"); oCodeCreate.GenerateCode(@"c:\temp\SampleCode.cs", "CSharp"); MessageBox.Show(@"Code exported to c:\temp\SampleCode.cs"); }