【发布时间】:2017-10-11 03:45:54
【问题描述】:
public interface IMyService
{
void GetValue();
}
public class MyService : ClientBase<IMyService>, IMyService
{
public MyService()
{
EndPoint = "Test";
}
public void GetValue()
{
}
}
public interface ICommunication
{
void Start();
}
public class ClientBase<T> : ICommunication
{
public string EndPoint { get; set; }
public void Start()
{
}
}
我的测试项目
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
ICommunication communication = new MyService();
}
}
如何从通信对象访问 EndPoint 属性?
我的目标是从 ICommunication 实例中读取 EndPoint 的值。如何将 ICommunication 接口转换为 ClientBase Generic 类
注意:我们有多个服务类。有没有办法从我的 ICommunication 中获取 ClientBase 的实例
【问题讨论】:
标签: c# wcf generics c#-4.0 reflection