0
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泛型類
注:我們有多個服務classes.Is有沒有辦法從我ICommunication
我忘了把這一個。我們有多個服務類。有沒有辦法從我的ICommunication中獲得ClientBase的實例 –