Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Equivalent to eval()
Message
De
29/03/2010 20:08:46
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
29/03/2010 19:57:23
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01457734
Message ID:
01458000
Vues:
43
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform