read return value from delegate
c#, delegates
Solution
public void Ip(string ip)
{
if (Callback != null)
{
List<String> valueReturnedByCallback = Callback();
}
}
Problem
I am not sure if I understood the usage of delegates correctly but I would like to read delegate return value in publisher class. The example is below with description. ``` //Publisher class public class ValidateAbuse { public delegate List<String> GetAbuseList(); public static GetAbuseList Callback; public void Ip(string ip) { // I would like to read GetAbuseList value (List<String>) here. How to do that? } } //Subscriber class class Server { public static void Start() { ValidateAbuse.Callback = GetIpAbuseList; ValidateAbuse.Ip(MyIp); } private static List<string> GetIpAbuseList() { //return List<String> to ValidateAbuse class and use return value in public void Ip(string ip) method } ```