Created
July 23, 2018 06:56
-
-
Save mojeld/4cd2b205b5536696a333ff0ba553b9ad to your computer and use it in GitHub Desktop.
C# Lambda Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ラムダ式で渡すための宣言 | |
public delegate void Proc<in T>(T arg1); | |
//ラムダ引数で渡す関数 | |
private void Lambda_test(Proc<int> f) | |
{ | |
for (int i = 0; i < 100; ++i) | |
{ | |
f(i); | |
} | |
} | |
//ボタンイベントで使う。 | |
private async void Button_ClickAsync(object sender, RoutedEventArgs e) | |
{ | |
var s = Task.Run( ()=>{ | |
Lambda_test(async (int i) => | |
{ | |
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => { | |
Debug.WriteLine(i); | |
}); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment