Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Equivalent to eval()
Message
From
29/03/2010 20:08:46
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
29/03/2010 19:57:23
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01457734
Message ID:
01458000
Views:
42
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform