PowerShell Action delegate
PowerShell Action delegate
Action/Funcはdelegate型
- Action : 戻り値なし、引数なし。
- Action
: 戻り値なし、引数1 - Func<T,TResult: 戻り値1,引数1
PowerShellでは
- [action]
- [action[int]]
- [func[int][int]] ?
- or func[int,int]] ?
Funcの例
Func<T,TResult>
using System; public class GenericFunc { public static void Main() { // Instantiate delegate to reference UppercaseString method Func<string, string> convertMethod = UppercaseString; string name = "Dakota"; // Use delegate instance to call UppercaseString method Console.WriteLine(convertMethod(name)); } private static string UppercaseString(string inputString) { return inputString.ToUpper(); } }
参考
http://stackoverflow.com/questions/19849848/powershell-how-to-create-a-delegate
System.Action
https://msdn.microsoft.com/ja-jp/library/system.action(v=vs.110).aspx
System.Action
https://msdn.microsoft.com/ja-jp/library/018hxwa8(v=vs.110).aspx
System.Func<T,TResult>
https://msdn.microsoft.com/ja-jp/library/bb549151(v=vs.110).aspx