Hi: The following is a LINQ to JS share, if there is a coincidence is purely coincidental
(function () {Array.prototype.first = function (predicate, def) {var l = this.length; if (!predicate) return l? This[0]: def = = null? Null:def; for (var i = 0; i < L; i++) if (predicate (this[i], I, this)) return this[i]; return def = = null? Null:def; }; Array.prototype.where = Array.prototype.filter | | function (predicate, context) {context = context | | window; var arr = []; var L = this.length; for (var i = 0; i < L; i++) if (Predicate.call (context, this[i], I, this) = = = True) Arr.push (This[i]); return arr; }; Array.prototype.select = Array.prototype.map | | Function (Selector, context) {context = context | | window; var arr = []; var L = this.length; for (var i = 0; i < l; i++) Arr.push (Selector.call (context, this[i], I, this)); return arr; };}) ();
How to use: List.first (function (t) {return T.value.trim () = = City.trim ();});
JS simulation expands C # LINQ expressions to share LINQ to JS