Hello...
I have been working with the .NET development environments ever since it was commercially released in 2001.
I am fluent both in VB.NET and C#, though my preferred language has always been VB.NET (chalk it up to my many years as a DBase developer).
In any event, who do language designers make the lives of us developers and engineers so god awful difficult?
Recently, I have been developing a complex extension for a new commercial application I have been developing. This paid-for extension will provide the application with a number of security features, including application password processing.
As a result, this extension, which will be loaded at run-time (if a user purchases it) will provide the password entry form as the initial aspect of the application startup (and the user has previously set up a password in the application's database).
OK, good so far. The password entry form has a property in it, which will be accessed by Reflection, which will hold the entered password. This way, the parent\host application can access the data in a more approriate way instead of this property simply being a public string.
So how do we have to get access to such data?
>>>
loPropertyInfo = loWindow.GetType().GetProperty("ENTERED_PASSWORD")
lsEnteredPassword = DirectCast(loPropertyInfo.GetValue(loWindow, Nothing), String)
<<<
This solution took me close to 3 hours to find; at least for the one that I found actually works.
The question is, why does one have to again do a GetValue call of the PropertyInfo class, whic then has to onec again refer the calling method back to the original source of where the property is defined (in this case "ENTERED_PASSWORD" in the password entry form, which is defined as "loWindow")?
Of all the stupid things that Microsoft has come up with this has got to be one the dumbest.
One would think that once you get the PropertyInfo object you could simply access the named property value from it. And even though you can list out the named property information, getting a value is another gyration completely.
Any thoughts on this would be most appreciative as I hate it when I am looking for something that should be relatively straight forward and simple only to find this kind of disjointed nonsense.
And yes, I know this may have been a result of the internal designer decisions. But you know what? I have seen this in many compilers I have worked with over the years and it seems that in more than a few instances the internal designers are completely out of touch with reality.
What else would a developer want most from a PropertyInfo object than a property's value?
Thank you...
What I have tried:
I have done quite a bit of research on this issue with practically all of the found solutions not providing working results. The solution noted in my question has been the only working solution I have been able to find in this regard...