How to link a property setter to a delegate?

Posted by Danvil on Stack Overflow See other posts from Stack Overflow or by Danvil
Published on 2010-04-27T11:56:18Z Indexed on 2010/04/27 12:03 UTC
Read the original article Hit count: 215

Filed under:

I would like to give a property setter to a delegate. How is this done?

class A {
  private int count;
  public int Count {
    get { return count; }
    set { count = value; }
  }
}
A a = new A();   
delegate void ChangeCountDelegate(int x);
ChangeCountDelegate dlg = ... ? // should call a.Count = x

© Stack Overflow or respective owner

Related posts about c#