{"id":1336,"date":"2015-04-14T02:25:15","date_gmt":"2015-04-13T18:25:15","guid":{"rendered":"http:\/\/www.clonefactor.com\/wordpress\/?p=1336"},"modified":"2015-04-14T22:12:41","modified_gmt":"2015-04-14T14:12:41","slug":"ios-linq","status":"publish","type":"post","link":"https:\/\/www.clonefactor.com\/wordpress\/program\/unity3d\/1336\/","title":{"rendered":"IOS Linq"},"content":{"rendered":"<p>\u9ebb\u7169\u7684 Apple (\u9760), \u4eca\u5929 release iOS \u7684\u6642\u5019\u5931\u6557, \u539f\u56e0\u53c8\u662f iOS \u5c0d System.Linq \u7684\u652f\u63f4\u554f\u984c. <del>(@#% \u5783\u573e Apple SDK)<\/del><\/p>\n<p>\u627e\u932f\u8655, \u4ee5\u4e0b\u6709 2 \u7d44 Linq, \u53ea\u6709\u5176\u4e2d\u4e00\u7a2e\u53ef\u4ee5\u6210\u529f\u57f7\u884c<\/p>\n<pre class=\"brush:csharp\">public class MyClass\r\n{\r\n\tpublic string text;\r\n}\r\npublic MethodTest()\r\n{\r\n\t\/\/ both working on android &amp; iOS\r\n\tList&lt;MyClass&gt; text02 = new List&lt;MyClass&gt;();\r\n\t\/\/ MyClass is the custom class, when new object it create object instance.\r\n\ttext02.Add(new MyClass(){ text = \"1\"});\r\n\ttext02.Add(new MyClass(){ text = \"12\"});\r\n\ttext02.Add(new MyClass(){ text = \"123\"});\r\n\tvar rst02 = text02.Where(x =&gt; x.text.Length = 2).FirstOrDefault();\r\n\t\r\n\t\r\n\t\/\/ iOS will fail to compile\r\n\tList&lt;string&gt; text01 = new List&lt;string&gt;();\r\n\t\/\/ &lt;-- the reason to fail non-instance class e.g. { int, string, float, bool...etc }\r\n\ttext01.Add(\"1\");\r\n\ttext01.Add(\"12\");\r\n\ttext01.Add(\"123\");\r\n\tvar rst01 = text01.Where(x =&gt; x.Length == 2).FirstOrDefault();\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9ebb\u7169\u7684 Apple (\u9760), \u4eca\u5929 release iOS \u7684\u6642\u5019\u5931\u6557, \u539f\u56e0\u53c8\u662f iOS \u5c0d Sy &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[16,69,68],"class_list":["post-1336","post","type-post","status-publish","format-standard","hentry","category-unity3d","tag-c-2","tag-ios","tag-linq"],"_links":{"self":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/1336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/comments?post=1336"}],"version-history":[{"count":0,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/1336\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/media?parent=1336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/categories?post=1336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/tags?post=1336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}