currently the code which i have is generating the properties like
private int integerProperty
{
get
{
return integerField;
}
set
{
integerField = value;
}
}
I wanted the properties to be simple like…
private int integerProperty
{
get;
set;
}
The code i have with me is
CodeMemberProperty property1 = new CodeMemberProperty();
property1.GetStatements.Add(new CodeMethodReturnStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "integerField")));
property1.SetStatements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "integerField"),new CodePropertySetValueReferenceExpression()));
type1.Members.Add(property1);
Anyone please help. Thanks in advance.
As Botz3000 mentioned, it’s officially not possible. However, with the following hack you can implement it:
By appending
{ get; set; }to the field name, it will generate a property in the actual source code.