I'm having trouble finding the right method to determine at runtime the data
type of the fields in a class.
here's what I've got so far:
Public Class ImgSubmissionRe cord
Public fileName As String
Public thumbnail As Bitmap
Public fileSize As Int64
Public fileDate As DateTime
Public disposition As Int16
End Class
Imports System.Reflecti on
Public Class debugControl
Inherits System.Web.UI.U serControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
End Sub
Protected WithEvents lblDebug As System.Web.UI.W ebControls.Labe l
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim anObject As New ImgSubmissionRe cord
Dim MemInfo, memInfoArray() As MemberInfo
Dim aType As Type = anObject.GetTyp e
memInfoArray = aType.GetMember s(BindingFlags. Public Or
BindingFlags.In stance)
For Each MemInfo In memInfoArray
Me.lblDebug.Tex t = Me.lblDebug.Tex t + "<br>" + MemInfo.Name + "/" +
System.Type.Get Type(MemInfo.Ge tType.ToString) .ToString
Next
End Sub
End Class
I get the name for each member of the class ok, but for the type I get
"System.Reflect ion.RuntimeFiel dInfo"
instead of string or int16, or bitmap, or whatever type the member is. How
do I get this information at runtime?
-Larry
type of the fields in a class.
here's what I've got so far:
Public Class ImgSubmissionRe cord
Public fileName As String
Public thumbnail As Bitmap
Public fileSize As Int64
Public fileDate As DateTime
Public disposition As Int16
End Class
Imports System.Reflecti on
Public Class debugControl
Inherits System.Web.UI.U serControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
End Sub
Protected WithEvents lblDebug As System.Web.UI.W ebControls.Labe l
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim anObject As New ImgSubmissionRe cord
Dim MemInfo, memInfoArray() As MemberInfo
Dim aType As Type = anObject.GetTyp e
memInfoArray = aType.GetMember s(BindingFlags. Public Or
BindingFlags.In stance)
For Each MemInfo In memInfoArray
Me.lblDebug.Tex t = Me.lblDebug.Tex t + "<br>" + MemInfo.Name + "/" +
System.Type.Get Type(MemInfo.Ge tType.ToString) .ToString
Next
End Sub
End Class
I get the name for each member of the class ok, but for the type I get
"System.Reflect ion.RuntimeFiel dInfo"
instead of string or int16, or bitmap, or whatever type the member is. How
do I get this information at runtime?
-Larry
Comment