문제

I have this java method signature:

public static <T extends Comparable<T>> Queue<T> naturalMergeSort(Queue<T> input)

what would the C# equivalent be?

도움이 되었습니까?

해결책

The C# equivalent would be:

public static Queue<T> naturalMergeSort<T>(Queue<T> input) where T : IComparable<T>

Note that in C# the interface is IComparable<T> instead of Comparable<T>, and the generic argument goes at the end of the method name as well.

다른 팁

in c# it would be as below:

public static Queue<T> NaturalMergeSort<T>(Queue<T> input) where T : IComparable<T>{}  
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top