❔ What of use is the identifier for the delegate?

I do think
public delegate void NumManipulationHandler(string state);
public delegate void NumManipulationHandler(string state);
can be modified into
public delegate void NumManipulationHandler(string);
public delegate void NumManipulationHandler(string);
but it hates to do it.
7 Replies
Thinker
Thinker2y ago
Afaik there is literally no purpose to it, other than perhaps being able to use named arguments
thirteenbinary
thirteenbinaryOP2y ago
Could you please give an example for the named arguments related to it?
MODiX
MODiX2y ago
thinker227#5176
REPL Result: Success
delegate void Foo(int a, string b);

Foo foo = (a, b) => Console.WriteLine($"{b} {a}");
foo(b: "abc", a: 2);
delegate void Foo(int a, string b);

Foo foo = (a, b) => Console.WriteLine($"{b} {a}");
foo(b: "abc", a: 2);
Console Output
abc 2
abc 2
Compile: 689.734ms | Execution: 107.104ms | React with ❌ to remove this embed.
Thinker
Thinker2y ago
Ex. like this, being able to put the arguments out of order when calling the delegate
thirteenbinary
thirteenbinaryOP2y ago
Thank u.
jcotton42
jcotton422y ago
Or bool arguments I nearly always name bool arguments when using a literal
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server