I think I got it now.
Alas, you'll need those extra two methods...
What I can suggest is to get rid of m_Member variable if possible. Just
delegate calls to RegularClassProp to an instance of RemoteObj:
public int RegularClassProp
{
set { remoteObjInstance.RemoteProp = value; }
get { return remoteObjInstance.RemoteProp; }
}
This way you don't need to syncronize values in two fields.
HTH,
Alexander
"Sharon" <Sh****@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
OK, here is a code show the trouble:
public delegate void SomeSetEventHandler(int arg);
public delegate int SomeGetEventHandler();
public class RemoteObj : MarshalByRefObject
{
public event SomeSetEventHandler SomeSetHandler;
public event SomeGetEventHandler SomeGetHandler;
public int RemoteProp
{
set { SomeSetHandler(value); }
get { return SomeGetHandler(); }
}
}
public class RegularClass
{
private int m_Memeber = 0;
public RegularClass()
{
// Getting a reference to the local RemoteObj... RemoteObjInstance
RemoteObjInstance.SomeSetHandler += new
SomeSetEventHandler(this.ClassPropSetWaraper);
RemoteObjInstance.SomeGetHandler += new
SomeGetEventHandler(this.ClassPropGetWaraper);
}
// I want to have only this property !
public int RegularClassProp
{
set { m_Memeber = value; }
get { return m_Memeber; }
}
// But I must add also a warper set and get method, like this Set method.
public void ClassPropSetWaraper(int arg)
{
RegularClassProp = arg;
}
// And this Get method !!!
public int ClassPropGetWaraper()
{
return RegularClassProp;
}
}
So you see, I want to avoid the double delegate declaration + the double
event declaration + the two warping set and get method. all of this is
because the delegate can not point to a class property.