I have the following code:
interface IConverter<T, U>
{
U Convert(T obj);
}
interface IBusinessEntityConveter<T, U> : IConverter<T, U>
where U : BusinessEntity
{
}
class LookupConveter<B> : IBusinessEntityConveter<Lookup, B>, IConverter<Lookup, Moniker>
where B : BusinessEntity, new()
{
#region IConverter<Lookup, Moniker> Members
public Moniker Convert(Lookup obj)
{
//...
}
#endregion
#region IConverter<Lookup,B> Members
public B Convert(Lookup obj)
{
//...
}
#endregion
}
I am getting this error:
Error 2 '
Convertors.LookupConveter<B>
' cannot implement both 'Convertors.IConverter<Microsoft.Crm.Sdk.Lookup,B>
' and 'Convertors.IConverter<Microsoft.Crm.Sdk.Lookup,Microsoft.Crm.Sdk.Moniker>
' because they may unify for some type parameter substitutions
Is there a way to specify that T isn't a business entity?