[英]How can I create a list of a generic type that will be passed as a parameter (VB.Net)
say I have two POCOs I'm using in EF code first 说我先在EF代码中使用两个POCO
Public class C1
property F1 as integer
End Class
Public class C2
property F2 as String
End Class
I want to have a function that will create a list either of C1 or C2, to be used in some generic operation, such that 我想拥有一个可以创建C1或C2列表的函数,以便在某些通用操作中使用,例如
Sub MySub(type_of_class)
private lst as new List(of type_of_class)
...
End Sub
Will either create a list of C1 or of C2. 将创建C1或C2的列表。
I know generics are probably the answer by my knowlege is kind of generic :-) 我知道泛型可能是我的知识的答案是一种泛型:-)
thanks! 谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.