Declare class as partial class in CodeDOM
-
I have this code: Stream s = File.Open(@destinationDirectory + tableName + ".cs", FileMode.Create); StreamWriter sw = new StreamWriter(s); CodeGeneratorOptions cop = new CodeGeneratorOptions(); CodeNamespace cdm = new CodeNamespace(nameSpace); CSharpCodeProvider cscProvider = new CSharpCodeProvider(); ICodeGenerator cscg = cscProvider.CreateGenerator(sw); CodeTypeDeclaration ctd = new CodeTypeDeclaration(tableName); ctd.IsClass = true; ctd.TypeAttributes = System.Reflection.TypeAttributes.Public; This works just fine for creating the class. But, I want to declare this a partial class for this reason. I have a main code file with methods and what not. But, I am creating the properties for the class dynamically. So I want this class to be a partial class file that is never opened and can be replaced any time. So I need to say "public partial class". Does anyone know how? Thanks, Nick
-------------------------------------------------------- 1 line of code equals many bugs. So don't write any!! My mad coder blog
-
I have this code: Stream s = File.Open(@destinationDirectory + tableName + ".cs", FileMode.Create); StreamWriter sw = new StreamWriter(s); CodeGeneratorOptions cop = new CodeGeneratorOptions(); CodeNamespace cdm = new CodeNamespace(nameSpace); CSharpCodeProvider cscProvider = new CSharpCodeProvider(); ICodeGenerator cscg = cscProvider.CreateGenerator(sw); CodeTypeDeclaration ctd = new CodeTypeDeclaration(tableName); ctd.IsClass = true; ctd.TypeAttributes = System.Reflection.TypeAttributes.Public; This works just fine for creating the class. But, I want to declare this a partial class for this reason. I have a main code file with methods and what not. But, I am creating the properties for the class dynamically. So I want this class to be a partial class file that is never opened and can be replaced any time. So I need to say "public partial class". Does anyone know how? Thanks, Nick
-------------------------------------------------------- 1 line of code equals many bugs. So don't write any!! My mad coder blog
nevermind, its a boolean property in the code type declaration
-------------------------------------------------------- 1 line of code equals many bugs. So don't write any!! My mad coder blog
-
nevermind, its a boolean property in the code type declaration
-------------------------------------------------------- 1 line of code equals many bugs. So don't write any!! My mad coder blog
Happens to me all the time: ask a question to which I didn't bother enough/was too deep thinking to quickly find the answer myself. Best regards... :-D Vini - Csharpian