I use getters and seters to instantiate the class.
Is it possible to configure a value set without having to have a private variable and do it directly by type?
For example, if my class is:
public class Cat() { public String Age{get; set; } }
and I want to create an instance of it:
new Cat({Age: "3"});
Now, if I have a ConvertToHumanYears function that I want to call before it is saved, I would assume that it is:
public class Cat() { public String Age{get; set{ value = ConvertToHumanYears(value); } }
But the above (and many of them) seem to return errors. Is it possible to do something like this without having an extra private variable that I set and get?
c # windows-phone-7 silverlight
Steve
source share