This article helps in generating
set methods for C# code automatically if the
private member variables are provided. Writing code for get/set methods is a time taking job if you have a number of
private member variables.
I got this idea because we had 85 fields in a class for which we needed to write
set methods. Writing the XML and applying the XSL to it saved my time.
Using the code
Generate an XML file with all private member variables with attributes
suffix is a name such as
_STR (Naming Convention).
Apply XSL to above generated XML.
Your XML file:
<Name datatype="int " suffix="int ">EmpCode</Name>
<Name datatype="string " suffix="str ">EmpName</Name>
Apply XSLT to the above XML. The following code will be generated:
public int EmpCode
_intEmpCode = value;
public string EmpName
_strEmpName = value;
Points of Interest
I learnt XML and XSLT.