Delegate: Method name expected error

c#, delegates

Solution

Remove the ():

D code = new D(x.ToString);

You want to specify the method, not execute it.

Problem

I'm trying to get the following simple Delegate example working. According to a book I've taken it from it should be ok, but I get a `Method name expected` error. ``` namespace TestConsoleApp { class Program { private delegate string D(); static void Main(string[] args) { int x = 1; D code = new D(x.ToString()); } } } ``` Any help?

Original source