T
tneon1
Guest
Hello,
I have a class that has a property array that is a list<of t>. I can get the properties from the class , but I cannot seem to access the property that is a List. Any help would be great.
Thank You
I have attached the Class and the loop that I am trying to get working
Here is the loop code:
For Each Prop As PropertyInfo In properties
If Prop.CanRead Then
If Prop.GetIndexParameters().Length = 0 And Prop.PropertyType.IsGenericType = False Then
Debug.Print("Name = " & Prop.Name & ", " & Prop.GetValue(PartParam, Nothing))
Else 'detect indexed object
For Each Index In Prop.GetIndexParameters()
Debug.Print("Count = " & Prop.GetIndexParameters().Count)
Debug.Print("Index Type = " & Index.GetType.ToString & ", Uppber Bound = " & IndexParameters().GetLowerBound(0))
Debug.Print("Name = " & Prop.Name & Index.Name & ", " & Prop.GetValue(PartParam, {Index}))
x = x + 1
Next
End If
End If
Next
Here is the Class code: The property is named RamDist
Imports HMS_Timing_Generator
Imports System.Collections.Generic
<Serializable()> Public Class cParamGroup
Private mCustomer As String
Private mSONum As String
Private mStyle As String
Private mPressStroke As Single
Private mPressType As String
Private mLinkPressID As Single
Private mRamUp As String
Private mRamDist As List(Of Single)
Private mPressLine As String
Private mFileNumber As String
Private mPartDesc As String
Private mSpm As Single
Private mCurrentFile As String
Private mCount As Integer
Public AxisType(MaxAisType) As cAxisType
Public DriveTrain(MaxAisType) As cDriveTrain
Public GearBox(MaxAisType) As cGearBox
Public AxisTypeParam(MaxAisType) As cAxisTypeParam
' Public Motor(MaxAisType) As cMotor
'Public Motor(MaxAisType) As cMotor
' Public Motor(MaxAisType) As stMotor
''' <summary>
''' Initializes a new instance of the <see cref="cParamGroup"/> class.
''' Public Constructor
''' </summary>
Public Sub New()
For Loop1 As Integer = 0 To MaxAisType
AxisType(Loop1) = New cAxisType
DriveTrain(Loop1) = New cDriveTrain
GearBox(Loop1) = New cGearBox
AxisTypeParam(Loop1) = New cAxisTypeParam
' Motor(Loop1) = New cMotor
'Motor(Loop1) = New stMotor
Next Loop1
mRamDist = New List(Of Single)
End Sub
Public Property CurrentFile As String
Set(ByVal val As String)
mCurrentFile = val
End Set
Get
Return mCurrentFile
End Get
End Property
''' <summary>
''' Gets or sets the press line.
''' </summary>
''' <value>
''' The press line property.
''' </value>
Public Property PressLine As String
Set(ByVal val As String)
mPressLine = val
End Set
Get
Return mPressLine
End Get
End Property
''' <summary>
''' Gets or sets the file number.
''' </summary>
''' <value>
''' The file number property.
''' </value>
Public Property FileNumber As String
Set(ByVal val As String)
mFileNumber = val
End Set
Get
Return mFileNumber
End Get
End Property
''' <summary>
''' Gets or sets the part desc.
''' </summary>
''' <value>
''' The part desc.
''' </value>
Public Property PartDesc As String
Set(ByVal val As String)
mPartDesc = val
End Set
Get
Return mPartDesc
End Get
End Property
''' <summary>
''' Gets or sets the SPM.
''' </summary>
''' <value>
''' The SPM.
''' </value>
Public Property Spm As Single
Set(ByVal val As Single)
mSpm = val
End Set
Get
Return mSpm
End Get
End Property
''' <summary>
''' Gets or sets the customer.
''' </summary>
''' <value>
''' The customer.
''' </value>
Public Property Customer As String
Set(ByVal val As String)
mCustomer = val
End Set
Get
Return mCustomer
End Get
End Property
''' <summary>
''' Gets or sets the so number.
''' </summary>
''' <value>
''' The so number property.
''' </value>
Public Property SoNumber As String
Set(ByVal val As String)
mSONum = val
End Set
Get
Return mSONum
End Get
End Property
''' <summary>
''' Gets or sets the style.
''' </summary>
''' <value>
''' The style property.
''' </value>
Public Property Style As String
Set(ByVal val As String)
mStyle = val
End Set
Get
Return mStyle
End Get
End Property
''' <summary>
''' Gets or sets the press stroke.
''' </summary>
''' <value>
''' The press stroke property.
''' </value>
Public Property PressStroke As Single
Set(ByVal val As Single)
mPressStroke = val
End Set
Get
Return mPressStroke
End Get
End Property
''' <summary>
''' Gets or sets the type of the press.
''' </summary>
''' <value>
''' The type of the press property.
''' </value>
Public Property PressType As String
Set(ByVal val As String)
mPressType = val
End Set
Get
Return mPressType
End Get
End Property
''' <summary>
''' Gets or sets the link press identifier.
''' </summary>
''' <value>
''' The link press identifier property.
''' </value>
Public Property LINKPressID As Single
Set(ByVal val As Single)
mLinkPressID = val
End Set
Get
Return mLinkPressID
End Get
End Property
''' <summary>
''' Gets or sets the ram up.
''' </summary>
''' <value>
''' The ram up property.
''' </value>
Public Property RamUp As String
Set(ByVal val As String)
mRamUp = val
End Set
Get
Return mRamUp
End Get
End Property
''' <summary>
''' Gets or sets the ram dist.
''' </summary>
''' <value>
''' The ram dist property.
''' </value>
Public Property RamDist() As List(Of Single)
Set(ByVal value As List(Of Single))
mRamDist = value
End Set
Get
Return mRamDist
End Get
End Property
Public Function GetCount() As Integer
GetCount = mRamDist.Count
End Function
End Class
Continue reading...
I have a class that has a property array that is a list<of t>. I can get the properties from the class , but I cannot seem to access the property that is a List. Any help would be great.
Thank You
I have attached the Class and the loop that I am trying to get working
Here is the loop code:
For Each Prop As PropertyInfo In properties
If Prop.CanRead Then
If Prop.GetIndexParameters().Length = 0 And Prop.PropertyType.IsGenericType = False Then
Debug.Print("Name = " & Prop.Name & ", " & Prop.GetValue(PartParam, Nothing))
Else 'detect indexed object
For Each Index In Prop.GetIndexParameters()
Debug.Print("Count = " & Prop.GetIndexParameters().Count)
Debug.Print("Index Type = " & Index.GetType.ToString & ", Uppber Bound = " & IndexParameters().GetLowerBound(0))
Debug.Print("Name = " & Prop.Name & Index.Name & ", " & Prop.GetValue(PartParam, {Index}))
x = x + 1
Next
End If
End If
Next
Here is the Class code: The property is named RamDist
Imports HMS_Timing_Generator
Imports System.Collections.Generic
<Serializable()> Public Class cParamGroup
Private mCustomer As String
Private mSONum As String
Private mStyle As String
Private mPressStroke As Single
Private mPressType As String
Private mLinkPressID As Single
Private mRamUp As String
Private mRamDist As List(Of Single)
Private mPressLine As String
Private mFileNumber As String
Private mPartDesc As String
Private mSpm As Single
Private mCurrentFile As String
Private mCount As Integer
Public AxisType(MaxAisType) As cAxisType
Public DriveTrain(MaxAisType) As cDriveTrain
Public GearBox(MaxAisType) As cGearBox
Public AxisTypeParam(MaxAisType) As cAxisTypeParam
' Public Motor(MaxAisType) As cMotor
'Public Motor(MaxAisType) As cMotor
' Public Motor(MaxAisType) As stMotor
''' <summary>
''' Initializes a new instance of the <see cref="cParamGroup"/> class.
''' Public Constructor
''' </summary>
Public Sub New()
For Loop1 As Integer = 0 To MaxAisType
AxisType(Loop1) = New cAxisType
DriveTrain(Loop1) = New cDriveTrain
GearBox(Loop1) = New cGearBox
AxisTypeParam(Loop1) = New cAxisTypeParam
' Motor(Loop1) = New cMotor
'Motor(Loop1) = New stMotor
Next Loop1
mRamDist = New List(Of Single)
End Sub
Public Property CurrentFile As String
Set(ByVal val As String)
mCurrentFile = val
End Set
Get
Return mCurrentFile
End Get
End Property
''' <summary>
''' Gets or sets the press line.
''' </summary>
''' <value>
''' The press line property.
''' </value>
Public Property PressLine As String
Set(ByVal val As String)
mPressLine = val
End Set
Get
Return mPressLine
End Get
End Property
''' <summary>
''' Gets or sets the file number.
''' </summary>
''' <value>
''' The file number property.
''' </value>
Public Property FileNumber As String
Set(ByVal val As String)
mFileNumber = val
End Set
Get
Return mFileNumber
End Get
End Property
''' <summary>
''' Gets or sets the part desc.
''' </summary>
''' <value>
''' The part desc.
''' </value>
Public Property PartDesc As String
Set(ByVal val As String)
mPartDesc = val
End Set
Get
Return mPartDesc
End Get
End Property
''' <summary>
''' Gets or sets the SPM.
''' </summary>
''' <value>
''' The SPM.
''' </value>
Public Property Spm As Single
Set(ByVal val As Single)
mSpm = val
End Set
Get
Return mSpm
End Get
End Property
''' <summary>
''' Gets or sets the customer.
''' </summary>
''' <value>
''' The customer.
''' </value>
Public Property Customer As String
Set(ByVal val As String)
mCustomer = val
End Set
Get
Return mCustomer
End Get
End Property
''' <summary>
''' Gets or sets the so number.
''' </summary>
''' <value>
''' The so number property.
''' </value>
Public Property SoNumber As String
Set(ByVal val As String)
mSONum = val
End Set
Get
Return mSONum
End Get
End Property
''' <summary>
''' Gets or sets the style.
''' </summary>
''' <value>
''' The style property.
''' </value>
Public Property Style As String
Set(ByVal val As String)
mStyle = val
End Set
Get
Return mStyle
End Get
End Property
''' <summary>
''' Gets or sets the press stroke.
''' </summary>
''' <value>
''' The press stroke property.
''' </value>
Public Property PressStroke As Single
Set(ByVal val As Single)
mPressStroke = val
End Set
Get
Return mPressStroke
End Get
End Property
''' <summary>
''' Gets or sets the type of the press.
''' </summary>
''' <value>
''' The type of the press property.
''' </value>
Public Property PressType As String
Set(ByVal val As String)
mPressType = val
End Set
Get
Return mPressType
End Get
End Property
''' <summary>
''' Gets or sets the link press identifier.
''' </summary>
''' <value>
''' The link press identifier property.
''' </value>
Public Property LINKPressID As Single
Set(ByVal val As Single)
mLinkPressID = val
End Set
Get
Return mLinkPressID
End Get
End Property
''' <summary>
''' Gets or sets the ram up.
''' </summary>
''' <value>
''' The ram up property.
''' </value>
Public Property RamUp As String
Set(ByVal val As String)
mRamUp = val
End Set
Get
Return mRamUp
End Get
End Property
''' <summary>
''' Gets or sets the ram dist.
''' </summary>
''' <value>
''' The ram dist property.
''' </value>
Public Property RamDist() As List(Of Single)
Set(ByVal value As List(Of Single))
mRamDist = value
End Set
Get
Return mRamDist
End Get
End Property
Public Function GetCount() As Integer
GetCount = mRamDist.Count
End Function
End Class
Continue reading...