谁能告诉我
public T Get<T>(int id)
和
public T Get(int id)
最佳答案
比较:
class First
{
public T Get<T>(int id) // T is declared in the method scope
{
}
}
和
class Second<T>
{
public T Get(int id) // T is declared in the class scope
{
}
}
还有第三种情况:
class Third<U>
{
public T Get<T>(int id) // T is declared in the method scope when class scope has another generic argument declared
{
}
}
关于c# - 差异T Get <T>(int id)和T Get(int id),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11188487/