Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JXUGのLTだけれどもUnity+iOS+LINQの話をしようと思う!

 JXUGのLTだけれどもUnity+iOS+LINQの話をしようと思う!

2014/11/22(土)に開かれた
第2回 Japan Xamarin User Group Conference 東日本編
(https://atnd.org/events/57246)

のLTで発表した資料です。

※元々はSlideShareで公開していた資料です。

RyotaMurohoshi

November 22, 2014
Tweet

More Decks by RyotaMurohoshi

Other Decks in Technology

Transcript

  1. ίϐϖͨ͠ίʔυͰɺ·ͣSumΛࢼ͠·͢ [Test] public void TestAverage () { string[] strings =

    new []{"Java", "Groovy", "C#", "F#"}; Assert.That (strings.Sum (it => it.Length), Is.EqualTo (14)); }
  2. ͜ͷௐࢠͰ࣍͸ToDic&nary [Test] public void TestToDictionay () { int[] nums =

    new []{0, 1, 2, 3, 4}; Dictionary<int, int> dict = nums.ToDictionary (it => it); }
  3. ݪҼʹͳ͍ͬͯΔFunc%on.Iden%tyͱ͔PredicateOf.Alwaysͱ͔ static class Function<T> { public static readonly Func<T, T>

    Identity = (t) => t; } static class PredicateOf<T> { public static readonly Func<T, bool> Always = (t) => true; } h"ps:/ /github.com/Unity3Technologies/mono/blob/unity34.5/mcs/class/System.Core/System.Linq/ Enumerable.cs ΑΓ
  4. LINQͷϝιουʹ͸ɺෳ਺Φʔόʔϩʔυ͕͋Δ΋ͷ͕͍͔ͭ͘ nums.FirstOrDefault (); nums.FirstOrDefault (predicate: it => it > 3);

    nums.ToDictionary (keySelector: it => it); nums.ToDictionary (keySelector: it => it, elementSelector: it => it.toString ()); σϦήʔτ͕Ҿ਺ʹ௥Ճ͞Ε͍ͯΔ΋ͷ͕ଟ͍