Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
C# で where 句を使用してできるように、Boo でジェネリック型の制約を表現する方法はありますか?
要するに、どのように書くのですか?:
class MyClass<T> where T:Icomparable<T> {...}
ありがとうございました
はい。構文は、基本型の宣言と同じです。
class MyClass[of T(IComparable of T)]
または、他の制約の場合:
class MyClass[of T1(class, constructor), T2(struct)]
Boo の現在の開発バージョンは、自分自身または他のジェネリック型パラメーターを参照するジェネリック型パラメーターの制約をサポートしていないと思います。間違ってるかもしれないけど。
はい、可能です。見る: