コードの次のセクションを確認してください (簡易版)
私の懸念は、ReadPath
使用している型の GetPath() を呼び出す必要があるクラスにあります。どうすればこれを達成できますか?
public interface IPath
{
string GetPath();
}
public class classA: IPath
{
string GetPath()
{
return "C:\";
}
}
public class classB: IPath
{
string GetPath()
{
return "D:\";
}
}
public class ReadPath<T> where T : IPath
{
public List<T> ReadType()
{
// How to call GetPath() associated with the context type.
}
}