In both Ruby and PHP (and I guess other languages as well) there are some utility methods that are called whenever a property is set. ( *instance_variable_set*
I know this has been properly answered but I'll include an example to show you the syntax to achieve what you want:
public class Person
{
private
public string FirstName
{
get
{
return _firstName;
}
set
{
// see how we can call a method below? or any code for that matter..
_firstName = SanitizeName(value);
}
}
}