可以像 C++ 函数重载那样重载 C3 泛型方法吗?
下面的代码是重载泛型方法的正确方法吗
class ReadFile<T> : IDisposable
{
private FileStream fstream;
private BinaryReader br;
public ReadFile(string filename)
{
// do all the initialization
}
public void readValue(double val)
{
val = br.ReadDouble();
}
public void readValue(float val)
{
val = br.ReadSingle();
}
public void readValue(T val)
{
throw new Exception("Not implemented");
}
}