gpt4 book ai didi

c# - T Get(int id) 和 T Get(int id) 的区别

转载 作者:行者123 更新时间:2023-11-30 19:11:30 25 4
gpt4 key购买 nike

谁能告诉我这两者的区别

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com