Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Naming conventions for custom methods?
Message
 
 
To
20/11/2008 09:37:32
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01362229
Message ID:
01363179
Views:
44
>>>>What happens if you access (or assign) a property for which you didn't write the code? Your example is exactly the best illustration of my objection: you have to write code to achieve default behavior. You access a property, you get its value returned. You assign it, it gets assigned the value passed. Why the know would you have to write code for that?
>>>>
>>>>Additionally, what's the syntax for adding a property on the fly?
>>>
>>>If I didn't write the code? In that case I will be a consumer of the class and can see its PEMs via Visual Studio's class diagram view (toolbar button as well as on the menu). That works for custom classes as well as those that come as part of the .NET framework. If that is what you meant -- not sure.
>>>
>>>Yes, you have to write code. To me it is very easy to do so, as described in an earlier reply, and a small part of the work involved in writing a class. It's not an issue for me at all.
>>
>>IOW, you can't have a property if there's no code for it, no matter who wrote it? Next thing you'll tell me there are no array properties...
>>
>>>I don't know how to add a property on the fly. Maybe one of the more experienced .NET developers here knows a way. Personally I'm not sure it's such a good idea. Can you give me an example of when you might want to do that?
>>
>>Yes. I can. Why do you want one? To give a solution for that particular case using a workaround?
>>
>>If it's a bad idea, go tell the Fox team that they screwed up :).
>
>In VFP I would do a check for a form property and if it didn't exist, create it on the fly. I did that mostly because I had to share code with other developers and merge it. In most cases eventually the check never failed and the property existed when code got merged. It wasn't a longterm solution.
>
>You can programmatically add controls to a form at runtime:
>
>http://support.microsoft.com/kb/319266
>
>Properties though I don't know about. I know you can create types at runtime and types can have properties, but I don't think you can add a property to a type at runtime. Maybe you could inherit from it and add a property or something. Still, wouldn't it require reflection since the property wasn't known at compile time? How else could you access it?
>
>This would be a good discussion in the net c# section where the net gurus would see it....

I think Dragan was just being a contrarian ;-)

Was thinking about this more in the car yesterday and still can't figure out why I would want to add a property to an object on the fly. Maybe that is something that is in VFP for tool builders, not tool users like me.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform