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# 中,您可以限制泛型类型:
public class Test<T> where T : SomeBaseClass
你能在 Visual Basic 中做同样的事情吗?
是的。你这样做:
Public Class Test(Of T As SomeBaseClass)
有关详细信息,请参阅通用类型文档中的约束。