Message
From
28/03/2010 20:40:43
 
 
To
28/03/2010 20:30:06
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01457734
Message ID:
01457737
Views:
41
>>>I have a number of properties which are objects ( business objects )
>>>
>>>If I have string which is the same as the name of one of those properties I would like to find the value of a property of the corresponding object.
>>>
>>>in VFP
>>>
>>>*property is called _Propmaster
>>>
>>>varstr = "Propmaster"
>>>prop = "_"+varstr+".count"
>>>
>>>mycount = eval(prop)
>>>
>>>
>>>Looking for a technique that will accomplish the same thing in .NET
>>>
>>>vb or C#
>>>
>>>TIA
>>
>>Have you looked into reflection?
>
>I am doing that right now and I suspect that is where the solution lies but haven't been able to get the syntax right I am importing Sytem.reflection and I am looking at Assembly.Getassembly but it wants a system.type not a string.
>
>I need something that will take the string and know that is the name of the business object I want.
>
>Something like me.properties("_Propmaster").count
>
>But there doesn't seem to be a properties collection of the form - unless that is what i am supposed to find with reflection.

Sorry that I don't know exact syntax of what you are looking for. I just read that Reflection works like Macro in VFP. Hopefully someone else will provide more constructive input.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View