读取列表中的项的名称和类型,对应于数据库的每一列的字段的名称和类型


 Public Shared Function getListOfProperty(ByRef item As Object) As List(Of clsNameAndProperty)

        Dim objLstOf As New List(Of clsNameAndProperty)
        Dim objNameAndProp As clsNameAndProperty
        For Each p As System.Reflection.PropertyInfo In item.GetType().GetProperties()
            If p.CanRead Then
                objNameAndProp = New clsNameAndProperty
                objNameAndProp.Name = p.Name
                If p.GetValue(item, Nothing) Is Nothing Then
                    objNameAndProp.PropertyType = p.PropertyType
                Else
                    objNameAndProp.PropertyType = p.GetValue(item, Nothing).GetType
                End If
                objNameAndProp.ExtNetModelType = MappingType(objNameAndProp.PropertyType)
                objLstOf.Add(objNameAndProp)
            End If
        Next
        Return objLstOf
    End Function

你可能感兴趣的:(EXT.NET)