麻煩的 Apple (靠), 今天 release iOS 的時候失敗, 原因又是 iOS 對 System.Linq 的支援問題. (@#% 垃圾 Apple SDK)
找錯處, 以下有 2 組 Linq, 只有其中一種可以成功執行
public class MyClass
{
public string text;
}
public MethodTest()
{
// both working on android & iOS
List<MyClass> text02 = new List<MyClass>();
// MyClass is the custom class, when new object it create object instance.
text02.Add(new MyClass(){ text = "1"});
text02.Add(new MyClass(){ text = "12"});
text02.Add(new MyClass(){ text = "123"});
var rst02 = text02.Where(x => x.text.Length = 2).FirstOrDefault();
// iOS will fail to compile
List<string> text01 = new List<string>();
// <-- the reason to fail non-instance class e.g. { int, string, float, bool...etc }
text01.Add("1");
text01.Add("12");
text01.Add("123");
var rst01 = text01.Where(x => x.Length == 2).FirstOrDefault();
}