Let’s write a challenge again, and this time not lose it… Yay…
So this is a thing I needed to do in one of my games and couldn’t find any solution online, so I did it myself and thought it might make for a good challenge. I hope you participate. 😉
We all probably know you can’t put a method as a parameter in a method by just specifying the return type (including void) and then add parenthesis and maybe some parameters, just like you would do with a normal parameter. Most of us probably know about the “Func” delegate. But it isn’t enough, because you must have a return type that isn’t void. So you must figure it out yourself (I know it’s surprising, but there isn’t a solution online, at least not that I found). I don’t want you to just make an option to put a specific return type and parameters amount/types, I want the option to put it as a parameter and only then specify the return type (there MUST be an option for void, the others are optional) and the parameters amount/type (each parameter should have a different custom type).
This is only a small challenge that came to my head while doing it myself, just for fun, so there won’t be anything like a time limit. You can just put your answer in the comments for that thread. Just make sure not to spoil the answer, so other people will be able to solve it themselves.
I thought about putting it as a beginners challenge, but then I thought about me doing it when I was a beginner and just…just no, please. It definitely isn’t advanced, because it only took me a few minutes to figure it out myself.
Please comment here to tell me if you will participate, because I would like to know how many people are joining. Please also tell me (reply to that thread) if I wasn’t specific enough about something, or you didn’t understand something, so I will be able to help. 😉