'C# Registering Delegate in Interface throw Target Framework Error

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;

enter image description here

public interface ICustomerServices
{
    delegate Task<IEnumerable<string>> AppCustomerListHandler();
    Task<string> GetMyName();
}

Can I solve this problem without upgrading any framework



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Damien_The_Unbeliever