Adding member variables to a class at Runtime..
-
hi, is it possible to add a member variable/function to a class at runtime.. This is possible in Python.. regards, nas
nasambur wrote:
is it possible to add a member variable/function to a class at runtime..
C# is a statically typed language, which means that the compiler needs to know about all members of a class during compilation, so that it can lay them out properly in memory. You can add static methods to a class using LCG[^], a new feature in .NET 2.0
Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | My Flickr | WinMacro
-
hi, is it possible to add a member variable/function to a class at runtime.. This is possible in Python.. regards, nas
-
No, that is not possible in .NET. What are you trying to accomplish? For questions like this there usually is an object oriented solution that works just as well, or simetimes even better.
--- single minded; short sighted; long gone;
-
hi, is it possible to add a member variable/function to a class at runtime.. This is possible in Python.. regards, nas
Have a look at http://www.codeproject.com/cs/library/typebuilderlib.asp You might find it interesting :)