I guess you want to somehow automatically call OnPropertyChanged method without specifying what particular property called it. Tough, but you can try another way...
public class SomeClasss
{
public string Name { get; set; }
bool _prop;
public bool MyProp
{
get { return _prop; }
set
{
_prop = value;
//OnPropertyChanged(thismember);
MethodBase method = System.Reflection.MethodBase.GetCurrentMethod();
string methodName = method.Name;
string className = method.ReflectedType.Name;
Name = className + "." + methodName;
}
}
}
And main...
class Program
{
static void Main()
{
SomeClasss c = new SomeClasss();
Console.WriteLine("Before: {0}", c.Name);
c.MyProp = true;
Console.WriteLine("After: {0}", c.Name);
Console.ReadKey();
}
}
Result:
Before:
After: SomeClasss.set_MyProp
Using presented code you can pass property name to OnPropertyChanged method which could be helpful. However I'm not sure what's your intention, so it may not fully fit your needs.