I'm generating a struct using CodeDom
var type = new CodeTypeDeclaration();
type.Name = "MyStructure";
type.IsStruct = true;
type.TypeAttributes = TypeAttributes.Public;
type.Members.
type.Members.Add(new CodeMemberField{
Attributes = System.CodeDom.MemberAttributes.Public | System.CodeDom.MemberAttributes.Const,
Name = "CreatedBy",
Type = new CodeTypeReference(typeof (String)),
InitExpression = new CodePrimitiveExpression("createdby"),
});
type.Members.Add(new CodeMemberField{
Attributes = System.CodeDom.MemberAttributes.Public | System.CodeDom.MemberAttributes.Const,
Name = "ModifiedBy",
Type = new CodeTypeReference(typeof (String)),
InitExpression = new CodePrimitiveExpression("modifiedby")
});
And when it generates it looks like this:
public struct MyStructure
{
public const string CreatedBy = "createdby";
public const string ModifiedBy = "modifiedby";
}
But I'd prefer it to not have the newlines in it:
public struct MyStructure
{
public const string CreatedBy = "createdby";
public const string ModifiedBy = "modifiedby";
}
Is it possible to get the generation to not include the new lines?