Question

For example i got a class and its got its own properties and i am passing the name of the class and the name of the property to be called to a function

Say for example exp is the variable which i am passing which contains a value = "ClassA,Property1"

           Function Property2BCalled(byval exp as String)

            dim classname = split(exp,",")(0)
            dim propertyname=split(exp,",")(1)
            dim value= classname.propertyname

           End Function

I wanna do something like that,given above.

Was it helpful?

Solution

You could use reflection to perform this task. Bear in mind that reflection is Slow but it could be done. You would enumerate the classes available in your assembly, when you find a name match, then you enumerate the properties and then Invoke the method/properties etc.

But it might be better to define an Interface and then have a common signature that your project can communicate with, then all you need is a Factory pumping out the appropriate instance of the class that is coming in your Data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top