我已经阅读了许多关于这个主题的帖子,其中最近的一篇是.NET - 将泛型集合转换为数据表。不幸的是,所有的尝试都没有成功。
我有一个结构体的泛型集合:
Private Structure MyStruct
Dim sState as String
Dim lValue as Long
Dim iLayer as Integer
End Structure
Dim LOStates As New List(Of MyStruct)
我需要用这个结构列表填充DataTable,但不知道如何实现。我在Visual Studio 2008中使用vb.net。
非常感谢任何帮助和见解。
@HansPassant GetType(T).GetFields()
对我来说返回一个空集合,我不得不使用GetProperties
,但这不会返回可转换为FieldInfo
的类型。我正在使用 ADO 实体模型。 - Sam Selikoff