Link to home
Start Free TrialLog in
Avatar of Michael Lam
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.
Avatar of mrjoltcola
mrjoltcola
Flag of United States of America image

private string _sourceDirectory;

public string SourceDirectory
        {
            get { return _sourceDirectory; }
            set { if(value != null) _sourceDirectory = value.Trim(); }
        }
ASKER CERTIFIED SOLUTION
Avatar of jhshukla
jhshukla
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Navneet Hegde
Navneet Hegde
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial