是否允许在 C# 方法中使用两种通用 T 类型(如 T 和 TSource)?

Is it allowed to use two generic T types (like T and TSource) in C# methods?

是否允许在 C# 方法中使用两种泛型 T 类型(如 T 和 TSource)?

public T GetResutls<T>(TSource sourceClass, string jsonString) where TSource : class

是的,但是你必须在尖括号中写下两种类型:

    public TResult GetResults<TResult, TSource>(TSource source)
    {
       // TODO: Implement your code here
    }