Skip to content

Instantly share code, notes, and snippets.

@amay077
Created September 24, 2011 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amay077/1239396 to your computer and use it in GitHub Desktop.
Save amay077/1239396 to your computer and use it in GitHub Desktop.
Reactive Extention(C#)のサンプルコード
Observable.Range(1, 10) // <------------------ 元のデータソース {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
.Where(num => { return num % 2 == 0; }) // <-- 偶数だけにフィルタリング
.Select(num => { return num * 10; }) // <-- 値を10倍に加工
.Subscribe(str => Debug.WriteLine(str)); // <-- 受信した結果をコンソールに出力
// output:
// 20
// 40
// 60
// 80
// 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment