2013-12-13 3 views
3

이 같은 피연산자 2 개의 피연산자를 빼는 일반적인 방법을 사용해야합니다.연산자가있는 일반 C#

public double GetResult<T>(T Arg1, T Arg2) : where T contains "-" operator 
{ 
    return Arg1 - Arg2; 
    //No, they are not value types, they are classes implementing the "-" operator 
    //And eventually, they can be value types 
} 

가능합니까? 제작자가있는 유형의 경우 where T = new()처럼 where T contains "-" operator이 있습니까?

+1

아니요, C#에서 이러한 제약 조건을 작성할 수 없습니다. –

답변