I'm writing some code in C# to call a method that takes a callback. The method being called takes a callback as an optional parameter.
In this case I don't really need a callback for production purposes, but I'd like to put a Debug.Log in while I'm developing so I'm throwing in a lambda to log the results.
(Note that I fully understand this isn't necessary, I can just do the log in the called method, but this question is more about me learning how to do things in c# than practicality)
WebUtilities.instance.PushExperimentDataToApi(experimentType, formData, result => Debug.Log(result));
This works fine, but I'd like to pull that debug log out into a variable and pass in the variable instead. In other languages that I'm used to (dynamic) I could do something like:
let debug = string => console.log(string)
myClass.myMethod(arg1, arg2, debug)
And from looking around it seems like I may be able to accomplish the same thing with tuples, but I haven't quite figured out how.
Is there a way to do this? Again, I know this isn't necessary or practical in this case, I'm just using this as an example to better understand the language while building a project.