C
C#3y ago
MTMB

Is there some way that I can have a method in a Dictionary?

For example something like this:
Dictionary<string, method> test = new Dictionary<string, method>();
test.add("Something", MyMethod());
Dictionary<string, method> test = new Dictionary<string, method>();
test.add("Something", MyMethod());
7 Replies
Steak
Steak3y ago
Action is the method
MTMB
MTMBOP3y ago
Like this?
Dictionary<string, Action>
Dictionary<string, Action>
Steak
Steak3y ago
should be
MTMB
MTMBOP3y ago
I'm getting this cannot convert from 'void' to 'System.Action'
Steak
Steak3y ago
no need to add () this
MTMB
MTMBOP3y ago
It worked, thanks
Steak
Steak3y ago
MyMethod not MyMethod()
Want results from more Discord servers?
Add your server