© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
55 replies
júlio

❔ Delegates

namespace MWE
{
    internal class Program
    {
        static int add(int a, int b) { 
            return a + b;
        }
        static void Main(string[] args)
        {
            Delegate esum = add;
            Console.WriteLine(esum(4, 6));
        }
    }
}
namespace MWE
{
    internal class Program
    {
        static int add(int a, int b) { 
            return a + b;
        }
        static void Main(string[] args)
        {
            Delegate esum = add;
            Console.WriteLine(esum(4, 6));
        }
    }
}

This code doesn't compile and I don't understand the issue.
What Am I doing wrong?
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Delegates
C#CC# / help
2y ago
Delegates
C#CC# / help
4y ago
✅ Practicing delegates
C#CC# / help
3y ago
❔ Understanding Delegates
C#CC# / help
3y ago
Next page