[c#] How can I convert this one line of ActionScript to C#?

I would like to convert this one line of code to C# code within a void:

param1:Function=null 

I am aware that in the void, it would be like "thing here" param1, but I dont know what "thing here" would exactly be. Thanks for your help!

This question is related to c# actionscript-3

The answer is


There is collection of Func<...> classes - Func that is probably what you are looking for:

 void MyMethod(Func<int> param1 = null) 

This defines method that have parameter param1 with default value null (similar to AS), and a function that returns int. Unlike AS in C# you need to specify type of the function's arguments.

So if you AS usage was

MyMethod(function(intArg, stringArg) { return true; }) 

Than in C# it would require param1 to be of type Func<int, siring, bool> and usage like

MyMethod( (intArg, stringArg) => { return true;} );