I am working on Azure Function FunctionA
that is TargetFramework netcoreapp3.1
. This FunctionA
calls another project for services whose TargetFramework is netstandard2.0
. In these service I have interface where I am trying to register Delegates
but unable to do so and getting version error; reference below;
public interface ICustomerServices
{
delegate Task<IEnumerable<string>> AppCustomerListHandler();
Task<string> GetMyName();
}
Can I solve this problem without upgrading any framework
>Solution :
A delegate just describes the "shape" that some methods will conform to. It doesn’t, in itself, describe an actual member of any enclosing type. If you want to consume a delegate within an interface, that’s not a problem, e.g.:
public delegate Task<IEnumerable<string>> AppCustomerListHandler();
public interface ICustomerServices
{
event AppCustomerListHandler AppCustomerListHandler;
Task<string> GetMyName();
void DoSomething(AppCustomerListHandler appCustomerListHandler);
}
Is just fine.