Y
yangxiaoxiang
I find there are some conditions I can't get data defined in another class.
One condition is:
namespace Test
{
class A
{
private int aValue;
public void method1()
{
B b=new B;
int value=b.GetValue(); //Cheers!I can get bValue in class B
}
}
class B
{
private int bValue;
public int GetValue()
{
return bValue;
}
public void method1()
{
//???How can I implement this method to get aValue in class A???
}
}
}
the second condition is in .net remoting:
namespace Test
{
class A
{
private int aValue;
public void method1()
{
TcpServerChannel channel=new TcpServerChannel(8086);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(B),"B",WellKnownOb
jectMode.Singleton);
//???then How can I implement this method to get bValue in class
B???
}
}
class B:System.MarshalByRefObject
{
private int bValue;
public void method1()
{
//???How can I implement this method to get aValue in class A???
}
}
}
One condition is:
namespace Test
{
class A
{
private int aValue;
public void method1()
{
B b=new B;
int value=b.GetValue(); //Cheers!I can get bValue in class B
}
}
class B
{
private int bValue;
public int GetValue()
{
return bValue;
}
public void method1()
{
//???How can I implement this method to get aValue in class A???
}
}
}
the second condition is in .net remoting:
namespace Test
{
class A
{
private int aValue;
public void method1()
{
TcpServerChannel channel=new TcpServerChannel(8086);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(B),"B",WellKnownOb
jectMode.Singleton);
//???then How can I implement this method to get bValue in class
B???
}
}
class B:System.MarshalByRefObject
{
private int bValue;
public void method1()
{
//???How can I implement this method to get aValue in class A???
}
}
}