How-to add methods and properties of C# classes?

M

Martin R-L

Let's say I've got * C# classes. I also have a smorgasbord of methods,
properties, events and event handlers (behaviors).

In design time (runtime would also be nice but isn't a necessity), I'd like
to add 0..* of the behaviors to 0..* of my classes.

In DHTML and IE, I would have designed Behaviors (HTC files) for each
method/property/event/event handler. These also work fine in runtime.

What's the cleverest way to pull off the same thing in C#?

Thanx!
// Martin R-L
 
N

Nicholas Paldino [.NET/C# MVP]

Martin,

I don't understand what you are trying to do exactly. If you mean you
are trying to add properties and methods to existing classes at runtime,
then this is going to be very, very difficult. Your approach to adding
dynamic behavior to a class would be best solved by having a generic
interface with events which are fired when the classes are being extended
are being modified (properties being changed, methods run, etc, etc).

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top