Separate each class into different cs file

Feb 6, 2012 at 1:54 PM
Edited Feb 7, 2012 at 9:22 AM

SOLVED

just added following gode where types are processed

 

 

public void GenerateCSharpCode(CodeTypeDeclaration type, CodeNamespace

codeNamespace)

{

 

 

CodeTypeDeclaration

targetClass = type;

 

 

CodeCompileUnit targetUnit = new CodeCompileUnit

();

targetUnit.Namespaces.Add(codeNamespace);

 

 

CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp"

);

 

 

CodeGeneratorOptions options = new CodeGeneratorOptions

();

options.BracingStyle =

 

"C"

;

 

 

using (StreamWriter sourceWriter = new StreamWriter("C:\\targetfolder\\" + type.Name + ".cs"

))

{

provider.GenerateCodeFromType(type, sourceWriter, options);

}

}