This answer is delayed, but may be useful to others if you want to generate properties for a class that do not contain support fields using xsd2Code. First we define the support field. The default properties in C # .net 2.0 were created using a private variable and a public property (where the C # keyword value is the value of the input string):
private string _loanId; public string LoanId { get{ return _loanId; } set{ _loanId = value; } }
This is very verbose, and since the description of the question can really inflate the class. In C # 3.0, this has changed, and properties can be created without support fields:
public string LoandId { get;set; }
I used xsd2Code ++ V 4.2 ... and was able to set parameters that would allow me to create properties without a support field.
Follow these steps:
- Install XSD2Code ++ or XSD2Code Community Edition
- Right-click on the .xsd file.
- In the options bar, set Application -> Target Framework to Net45
- In the options bar, set "Settings" → "Properties" → "Automatic Properties" to "true".
If you have automatic updates installed, you will see that the support properties disappear and remain with a much less complex class. You can also click the generate button to see the effects.
Hooray!
source share