Search An Enum Value inside of An Enum
I've tried the code below but it always returns nothing, It should enter
Protected Function GetTotalDebitAmount(ByRef roEntryDetailRecordBaseList As List(Of PPDEntryDetailRecord)) As String
Dim iTotal As Integer = 0
If Me.BatchHeaderRecord.ServiceClassCode = Convert.ToString(CInt(ServiceClassCodes.EntriesMixedDebitsAndCredits)) Then
For Each oEntryDetailRecord As PPDEntryDetailRecord In roEntryDetailRecordBaseList
If CBool(Array.IndexOf([Enum].GetValues(GetType(TransactionCodes.Debits)), CInt(oEntryDetailRecord.TransactionCode)) > 0) Then
iTotal += CInt(oEntryDetailRecord.Amount)
End If
Next
End If
Return CStr(iTotal)
End Function
I need some one who evaluate the part below:
If CBool(Array.IndexOf([Enum].GetValues(GetType(TransactionCodes.Debits)), CInt(o开发者_开发问答EntryDetailRecord.TransactionCode)) > 0) Then
Thanks.
Anyways,
I've found the answer:
If [Enum].IsDefined(GetType(TransactionCodes.Debits), CInt(oEntryDetailRecord.TransactionCode)) Then
iTotal += CInt(oEntryDetailRecord.Amount)
End If
精彩评论