Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

My Generic function using LINQ(orderBy thenBy)Not working on IOS

$
0
0
I have written this function public static Dictionary MySort(this Dictionary source, Type typeOfObject, bool isAscending = false, params string[] param) { if(param.Length == 0) return source; if (isAscending) { var temp = source.OrderBy (a => (typeOfObject.GetProperty (param [0])).GetValue (a.Value, null)); for (int i=1; i (typeOfObject.GetProperty(param[myVar])).GetValue (a.Value, null))); } return temp.ToDictionary(a=>a.Key, a=>a.Value); } else { var temp = source.OrderByDescending (a => (typeOfObject.GetProperty (param [0])).GetValue (a.Value, null)); for (int i=1; i (typeOfObject.GetProperty(param[myVar])).GetValue (a.Value, null))); } return temp.ToDictionary(a=>a.Key, a=>a.Value); } } I had to use sorting again and again all over my Project so i made this generic function. It works perfectly fine on all platforms except IOS it throws this exception Attempting to JIT compile method 'System.Linq.Enumerable:OrderBy, object> (System.Collections.Generic.IEnumerable`1>,System.Func`2, object>)' while running with --aot-only. I did some googling seems there is some solution to it. And an plugin available on asset store but i dont want to use it. (Well is there is no other option i can use it). I can do it without using LINQ but then i dont know how to do this genericly like this. Im using using 4.6. Are linq methods orderby thenby supported on IOS in this verrsion of Unity and MOno if yes then how can i make my function work. If not then what is the best alternative approach.

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>