C# Instantiate class which implements generic interface
- by Martijn B
Hi there,
I have some business classes which implements IBusinessRequest
for example:
public class PersonBusiness : IBusinessRequest<Person>
{ }
Besides this I have a function:
TypeHelper.CreateBusinessInstance(Type businessType, Type businessRequestType)
A requirement of a business class is that they must have a parameterless constructor, which I check in the TypeHelper.CreateBusinessInstance function.
I want to create a instance of type businessType (which is i.e PersonBusiness) with the generic value businessRequestType for IBusinessRequest<.
How can I get this done?
Thanks in Advance.
Gr
Martijn