Michael Lam
asked on
how to do further processing on c# auto-property
let's say i have property like this:
[DataMember]
public string SourceDirectory
{
get;
set;
}
but i want to further process the value during set so that it gets trimmed, is there a way to do that or must i use normal properties with a internal field? also, these are properties that are part of a XML serializable class.
[DataMember]
public string SourceDirectory
{
get;
set;
}
but i want to further process the value during set so that it gets trimmed, is there a way to do that or must i use normal properties with a internal field? also, these are properties that are part of a XML serializable class.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
public string SourceDirectory
{
get { return _sourceDirectory; }
set { if(value != null) _sourceDirectory = value.Trim(); }
}