Click here to Skip to main content
16,008,010 members
Please Sign up or sign in to vote.
3.67/5 (3 votes)
See more:
Hello everybody,

I am a student and several days ago I faced a problem in understanding the vb .net technology 'Reflection'. Could someone help me please?

How can I dynamically add attributes, properties and methods to the class body (I mean in run-time)?

Added-i was told that it is impossible to add properties directly.
in that case, can i use codeDom to programmly write code that creates a class inheriting my base class, and adding some properties to it?the names and types of properties will be sent as arguments.
Posted
Updated 28-Jan-11 0:26am
v3
Comments
Sergey Alexandrovich Kryukov 16-Oct-12 15:44pm    
Lie! And telling lies is a big sin.
--SA
Sergey Alexandrovich Kryukov 16-Oct-12 15:45pm    
Not true. Ever heard of System.Reflection.Emit?
--SA

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 28-Jan-11 10:07am    
That should teach the subject - my 5.
--SA
Sergey Alexandrovich Kryukov 16-Oct-12 15:46pm    
I was amazed by some irresponsible members trying to lie to OP. Oh..!
--SA
Sandeep Mewara 17-Oct-12 0:54am    
:doh:!
It might not be exactly what you are looking for but I wrote this code to be able to use run-time evaluated code on classes...Let me know if it helps ;)

The Story of ICalculated... the Calculated Column for a Class and More[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900