Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to do this in .NET
Message
From
15/04/2005 07:56:16
Walter Meester
HoogkarspelNetherlands
 
 
To
15/04/2005 06:01:24
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01004810
Message ID:
01005042
Views:
28
Hi Cetin,

>If you wouldn't ask for the code now (I believe I posted it partially before here) I did that using System.Reflection.

I thought this would come up. I've heard about the power of reflection. It would be nice though to see how it is used to the specified problem.

>However you ask for the optimal way:) In .Net there are too many classes and too many ways to reach to same endpoint so I'm not sure what I did was the optimal one or not. But also think of this:
>In .net you can get an xml representation of an object if it's serializable and might quickly process xml to find what you want - just another way.
>Up till now I couldn't find anything that I can do in VFP but not in .Net (it only takes more time in .Net but that's specific to my relatively much more little knowledge with .Net than it is with VFP).

My main struggle is here how to figure out if a property is available and how to access it, just like you can do in VFP with a simple:
IF PEMSTATUS(oObject, "MyCustumProperty",5) AND oObject.MyCustumProperty
Needless to say that I'm using such constructs a lot in my framework, and haven't quite found out how you efficiently can translate that into .NET. or actually in a strict typed language.

In fact people hinted me about interfacing, reflection etc, but any way you put it it does not seem to be a full replacement. In fact it seems I have to go back one level and see what I'm trying to achieve up here and find a strategic other solution to this particular problem. To be honest I'm not too fond of using interfaces as then the algorithm has to rely one the interfaces assigned to the target objects, which from a maintenance POV seems a bit problematic to me (I might be wrong though).

Reflection is something I though might be a solution, but do see this as a .NET implementation rather as a solution to other static typed languages. Besides, it seems that reflection is some mechanism that bypasses the static type checking, which really was the original question in the discussion where this started.


>PS: I used GetType() and Type class members like MemberInfo, FieldInfo, PropertyInfo etc instead of typeof() so I needn't know the type beforehand and create a switch for every possible new object. It looks like amembers() processing in VFP. Off topic I hate in VFP I need Pages/PageCount, Buttons/ButtonCount etc (yes there are Objects but still I hate:)

I agree those properties should not have been create in the first place...

Thanks,

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform