class MyClass{// ... Constructor and Stuffprivate: type MyProperty;public: __property type get_MyProperty() { return MyProperty; } __property void set_MyProperty( type value ) { MyProperty = value; }};
__delegate type MyPropertyGet(); __delegate void MyPropertySet( type value ); MyClass* obj = new MyClass();MyPropertyGet* myGet = new MyPropertyGet( obj, &MyClass::get_MyProperty ); MyPropertySet* mySet = new MyPropertySet( obj, &MyClass::set_MyProperty );
public delegate type MyPropertyGet(); public delegate void MyPropertySet( type s ); MyClass obj = new MyClass();MyPropertyGet getDel = (MyPropertyGet)Delegate.CreateDelegate( typeof(MyPropertyGet), obj, "get_MyProperty" ); MyPropertySet setDel = (MyPropertySet)Delegate.CreateDelegate( typeof(MyPropertySet), obj, "set_MyProperty" );
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.