Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Equivalent to eval()
Message
 
 
À
29/03/2010 20:08:46
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01457734
Message ID:
01458016
Vues:
48
>>For lurkers, I thought I'd post my results :
>>
>>this technique works for public properties and works well.
>>
>>Here's the VB version of what I did
>>
>>We are asssuming there are a dozen public properties of type BaseBO
>>Based on a string we are going to find out the number of records in that BO
>>(the actually string is derived from evaluating the displayvalue of an enum at run-time)
>>
>>
>>Dim childname as string = "GL"
>>Dim childbo as Basebo 
>>Dim pd As PropertyDescriptor = _
>>TypeDescriptor.GetProperties(Me).Find(childname, True)
>>
>>         If Not IsDBNull(pd) Then
>>                  childbo = CType(pd.GetValue(Me), BaseBO)
>>                  childcount = childbo.Count
>>          End If
>>
>>
>>Thanks Cetin
>>
>>(the function Michel posted is very useful when the BO is assigned to a private variable instead of a property )
>
>Birsey degil:)
>
>BTW download LinqPad 4 from www.linqpad.net if you haven't already. It simply rocks. Watch webcast for a peek of new features (you can even do interactive VB there although biased to C#:)
>Cetin

Thanks for the tip. But is SQL really antiquated? ;-)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform