I've got a Customer class that has a List<string
> Roles property. Much of the time I want to access that property as a list of strings, but on occasion I want to see it as a comma-delimited list.
I could certainly do that in a new method, and if I anticipated wanting to get the value of the variable in different formats (comma-delimited, tab-delimited, &ct) I would certainly do so. However, I'm toying with the idea of using two different properties to access the variable value, something along the lines of
public List<string> Roles
{
get { return this._Roles; }
set { this._Roles = value; }
}
and
public string RolesToString
{
get { do some work here to comma-delimit the list; }
}
Essentially I want to override the ToString() method of this particular list. Are there compelling reasons for doing 1 over the other? Is using two different properties to return the same variable value sufficiently non-standard to cause red flags?