Say i have the following two classes:
public class User
{
public int ID { get; }
public string Name { get; set; }
public void ChangeName(string newName)
{
Name = newName;
}
}
public class Mail
{
public void SendUserInfoChangeEmail()
{
throw new NotImplementedException();
}
}
and what i want to do is: when the someone edit user object name using the method ChangeName
the SendUserInfoChangeEmail
get called automatically.
And i know that i can use events to handle this issue, but what i want is to make a 3rd static class to build in it this events, and will say in the class: attach ChangeName
to SendUserInfoChangeEmail
How can i do this?
NOTE:
I don't want to put any event
handling or delegates in both user
and email classes i want everything
to manage through this third new
static class.