Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Inline get and set with CodeMemberProperty

$
0
0

Hi,
The following code:

CodeMemberProperty clrProperty = new CodeMemberProperty();
clrProperty.Attributes = MemberAttributes.Public | MemberAttributes.Final;
clrProperty.Name = property.Key;
clrProperty.HasGet = true;
clrProperty.HasSet = true;
clrProperty.Type = new CodeTypeReference(typeof(DateTime));
targetClass.Members.Add(clrProperty);

generates this:

public System.DateTime Start
{
    get
    {
    }
    set
    {
    }
}

I would like to get the getter and setter inline:

public System.DateTime Start
{
    get;
    set;
}

What do I need to change to achieve my goal?

Thanks



Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>