Question Locked

runtime creation of classes?

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I want to externalize the definition of classes to a xml fle and parse that file to get the declarative information about classes and use reflectionto create the classes and I should also be able to invoke them at runtime. can I separate the creation of classes from the invocation of the methods.

2 replies

by tony hopkinson

Is there some reason why you aren't using serialization?

I do this sort of thing with extension methods.

put all the calsses and their 'nornal functionality in one assembly.
Craete another assembly add a static classv for each one you want to load (same name is convenient) with a load method that extends the class to be loaded.

e.g.

internal static class SomeClass
{
public static SomeClass Load(this Some.Other.NameSpace.SomeClass argTarget, String argXmlSnippet)
{
}
}

this in loader dll would instantiate some class from someother dll, and fill it in from the xml.

Hths

This discussion is closed to new replies.