instantiate a class dynamically in runtime from an interface?

Y

yacrumb

Hello all,

how do these mocklibs create an instance from a given interface in
runtime?


class Mockery
{
public ISomething CreateMock(Type aType) {

// instantiate
// how?

}
}
 
J

Jon Skeet [C# MVP]

yacrumb said:
how do these mocklibs create an instance from a given interface in
runtime?

The good news is that most of the mock libraries are open source - so
you can find out yourself. Some use a remote proxy API in .NET which I
can't remember the name of immediately, others use code generation.
 

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