Hi
I was wondering if someone could let me know the best/correct way of doing this. I have a shortened example of code below:
In the beginning of the class I have a List of string containing all records. I have added each encapsulated field to the list in the set property and I need to maintain the order in the list. Is this way best way to do this? Or should I be doing this another cleaner way. I guess I’m asking for best coding techniques.
Thanks for any help
I was wondering if someone could let me know the best/correct way of doing this. I have a shortened example of code below:
In the beginning of the class I have a List of string containing all records. I have added each encapsulated field to the list in the set property and I need to maintain the order in the list. Is this way best way to do this? Or should I be doing this another cleaner way. I guess I’m asking for best coding techniques.
Thanks for any help
Code:
Class myclass()
{
public List<string> allRecords = new List<string>();
// Basically i am appending whatever is set to the end of the string with all these
string _recordStart = "HEADERSTART";
public string RecordStart
{
get { return _ recordStart; }
set
{
_ recordStart += value;
allRecords.Add(_recordStart);
}
}
private string _example= "EXAMPLE_STRING";
public string Example
{
get { return _ example; }
set
{
_example+= value;
allRecords.Add(_example);
}
}
// Many more encapsulated fields
string _recordEnd= "HEADEREND";
public string HdrRecordEnd
{
get { return _ recordEnd; }
set
{
_ recordEnd += value;
allRecords.Add(_recordEnd);
}
}
}
Comment