linq-vsdoc.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864
  1. /*--------------------------------------------------------------------------
  2. * linq-vsdoc.js - LINQ for JavaScript
  3. * ver 2.2.0.2 (Jan. 21th, 2011)
  4. *
  5. * created and maintained by neuecc <ils@neue.cc>
  6. * licensed under Microsoft Public License(Ms-PL)
  7. * http://neue.cc/
  8. * http://linqjs.codeplex.com/
  9. *--------------------------------------------------------------------------*/
  10. Enumerable = (function ()
  11. {
  12. var Enumerable = function (getEnumerator)
  13. {
  14. this.GetEnumerator = getEnumerator;
  15. }
  16. Enumerable.Choice = function (Params_Contents)
  17. {
  18. /// <summary>Random choice from arguments.
  19. /// Ex: Choice(1,2,3) - 1,3,2,3,3,2,1...</summary>
  20. /// <param type="T" name="Params_Contents" parameterArray="true">Array or Params Contents</param>
  21. /// <returns type="Enumerable"></returns>
  22. }
  23. Enumerable.Cycle = function (Params_Contents)
  24. {
  25. /// <summary>Cycle Repeat from arguments.
  26. /// Ex: Cycle(1,2,3) - 1,2,3,1,2,3,1,2,3...</summary>
  27. /// <param type="T" name="Params_Contents" parameterArray="true">Array or Params Contents</param>
  28. /// <returns type="Enumerable"></returns>
  29. }
  30. Enumerable.Empty = function ()
  31. {
  32. /// <summary>Returns an empty Enumerable.</summary>
  33. /// <returns type="Enumerable"></returns>
  34. }
  35. Enumerable.From = function (obj)
  36. {
  37. /// <summary>
  38. /// Make Enumerable from obj.
  39. /// 1. null = Enumerable.Empty().
  40. /// 2. Enumerable = Enumerable.
  41. /// 3. Number/Boolean = Enumerable.Repeat(obj, 1).
  42. /// 4. String = to CharArray.(Ex:"abc" => "a","b","c").
  43. /// 5. Object/Function = to KeyValuePair(except function) Ex:"{a:0}" => (.Key=a, .Value=0).
  44. /// 6. Array or ArrayLikeObject(has length) = to Enumerable.
  45. /// 7. JScript's IEnumerable = to Enumerable(using Enumerator).
  46. /// </summary>
  47. /// <param name="obj">object</param>
  48. /// <returns type="Enumerable"></returns>
  49. }
  50. Enumerable.Return = function (element)
  51. {
  52. /// <summary>Make one sequence. This equals Repeat(element, 1)</summary>
  53. /// <param name="element">element</param>
  54. /// <returns type="Enumerable"></returns>
  55. }
  56. Enumerable.Matches = function (input, pattern, flags)
  57. {
  58. /// <summary>Global regex match and send regexp object.
  59. /// Ex: Matches((.)z,"0z1z2z") - $[1] => 0,1,2</summary>
  60. /// <param type="String" name="input">input string</param>
  61. /// <param type="RegExp/String" name="pattern">RegExp or Pattern string</param>
  62. /// <param type="Optional:String" name="flags" optional="true">If pattern is String then can use regexp flags "i" or "m" or "im"</param>
  63. /// <returns type="Enumerable"></returns>
  64. }
  65. Enumerable.Range = function (start, count, step)
  66. {
  67. /// <summary>Generates a sequence of integral numbers within a specified range.
  68. /// Ex: Range(1,5) - 1,2,3,4,5</summary>
  69. /// <param type="Number" integer="true" name="start">The value of the first integer in the sequence.</param>
  70. /// <param type="Number" integer="true" name="count">The number of sequential integers to generate.</param>
  71. /// <param type="Optional:Number" integer="true" name="step" optional="true">Step of generate number.(Ex:Range(0,3,5) - 0,5,10)</param>
  72. /// <returns type="Enumerable"></returns>
  73. }
  74. Enumerable.RangeDown = function (start, count, step)
  75. {
  76. /// <summary>Generates a sequence of integral numbers within a specified range.
  77. /// Ex: RangeDown(5,5) - 5,4,3,2,1</summary>
  78. /// <param type="Number" integer="true" name="start">The value of the first integer in the sequence.</param>
  79. /// <param type="Number" integer="true" name="count">The number of sequential integers to generate.</param>
  80. /// <param type="Optional:Number" integer="true" name="step" optional="true">Step of generate number.(Ex:RangeDown(0,3,5) - 0,-5,-10)</param>
  81. /// <returns type="Enumerable"></returns>
  82. }
  83. Enumerable.RangeTo = function (start, to, step)
  84. {
  85. /// <summary>Generates a sequence of integral numbers.
  86. /// Ex: RangeTo(10,12) - 10,11,12 RangeTo(0,-2) - 0, -1, -2</summary>
  87. /// <param type="Number" integer="true" name="start">start integer</param>
  88. /// <param type="Number" integer="true" name="to">to integer</param>
  89. /// <param type="Optional:Number" integer="true" name="step" optional="true">Step of generate number.(Ex:RangeTo(0,7,3) - 0,3,6)</param>
  90. /// <returns type="Enumerable"></returns>
  91. }
  92. Enumerable.Repeat = function (obj, count)
  93. {
  94. /// <summary>Generates a sequence that contains one repeated value.
  95. /// If omit count then generate to infinity.
  96. /// Ex: Repeat("foo",3) - "foo","foo","foo"</summary>
  97. /// <param type="TResult" name="obj">The value to be repeated.</param>
  98. /// <param type="Optional:Number" integer="true" name="count" optional="true">The number of times to repeat the value in the generated sequence.</param>
  99. /// <returns type="Enumerable"></returns>
  100. }
  101. Enumerable.RepeatWithFinalize = function (initializer, finalizer)
  102. {
  103. /// <summary>Lazy Generates one value by initializer's result and do finalize when enumerate end</summary>
  104. /// <param type="Func&lt;T>" name="initializer">value factory.</param>
  105. /// <param type="Action&lt;T>" name="finalizer">execute when finalize.</param>
  106. /// <returns type="Enumerable"></returns>
  107. }
  108. Enumerable.Generate = function (func, count)
  109. {
  110. /// <summary>Generates a sequence that execute func value.
  111. /// If omit count then generate to infinity.
  112. /// Ex: Generate("Math.random()", 5) - 0.131341,0.95425252,...</summary>
  113. /// <param type="Func&lt;T>" name="func">The value of execute func to be repeated.</param>
  114. /// <param type="Optional:Number" integer="true" name="count" optional="true">The number of times to repeat the value in the generated sequence.</param>
  115. /// <returns type="Enumerable"></returns>
  116. }
  117. Enumerable.ToInfinity = function (start, step)
  118. {
  119. /// <summary>Generates a sequence of integral numbers to infinity.
  120. /// Ex: ToInfinity() - 0,1,2,3...</summary>
  121. /// <param type="Optional:Number" integer="true" name="start" optional="true">start integer</param>
  122. /// <param type="Optional:Number" integer="true" name="step" optional="true">Step of generate number.(Ex:ToInfinity(10,3) - 10,13,16,19,...)</param>
  123. /// <returns type="Enumerable"></returns>
  124. }
  125. Enumerable.ToNegativeInfinity = function (start, step)
  126. {
  127. /// <summary>Generates a sequence of integral numbers to negative infinity.
  128. /// Ex: ToNegativeInfinity() - 0,-1,-2,-3...</summary>
  129. /// <param type="Optional:Number" integer="true" name="start" optional="true">start integer</param>
  130. /// <param type="Optional:Number" integer="true" name="step" optional="true">Step of generate number.(Ex:ToNegativeInfinity(10,3) - 10,7,4,1,...)</param>
  131. /// <returns type="Enumerable"></returns>
  132. }
  133. Enumerable.Unfold = function (seed, func)
  134. {
  135. /// <summary>Applies function and generates a infinity sequence.
  136. /// Ex: Unfold(3,"$+10") - 3,13,23,...</summary>
  137. /// <param type="T" name="seed">The initial accumulator value.</param>
  138. /// <param type="Func&lt;T,T>" name="func">An accumulator function to be invoked on each element.</param>
  139. /// <returns type="Enumerable"></returns>
  140. }
  141. Enumerable.prototype =
  142. {
  143. /* Projection and Filtering Methods */
  144. CascadeBreadthFirst: function (func, resultSelector)
  145. {
  146. /// <summary>Projects each element of sequence and flattens the resulting sequences into one sequence use breadth first search.</summary>
  147. /// <param name="func" type="Func&lt;T,T[]>">Select child sequence.</param>
  148. /// <param name="resultSelector" type="Optional:Func&lt;T>_or_Func&lt;T,int>" optional="true">Optional:the second parameter of the function represents the nestlevel of the source sequence.</param>
  149. /// <returns type="Enumerable"></returns>
  150. },
  151. CascadeDepthFirst: function (func, resultSelector)
  152. {
  153. /// <summary>Projects each element of sequence and flattens the resulting sequences into one sequence use depth first search.</summary>
  154. /// <param name="func" type="Func&lt;T,T[]>">Select child sequence.</param>
  155. /// <param name="resultSelector" type="Optional:Func&lt;T>_or_Func&lt;T,int>" optional="true">Optional:the second parameter of the function represents the nestlevel of the source sequence.</param>
  156. /// <returns type="Enumerable"></returns>
  157. },
  158. Flatten: function ()
  159. {
  160. /// <summary>Flatten sequences into one sequence.</summary>
  161. /// <returns type="Enumerable"></returns>
  162. },
  163. Pairwise: function (selector)
  164. {
  165. /// <summary>Projects current and next element of a sequence into a new form.</summary>
  166. /// <param type="Func&lt;TSource,TSource,TResult>" name="selector">A transform function to apply to current and next element.</param>
  167. /// <returns type="Enumerable"></returns>
  168. },
  169. Scan: function (func_or_seed, func, resultSelector)
  170. {
  171. /// <summary>Applies an accumulator function over a sequence.</summary>
  172. /// <param name="func_or_seed" type="Func&lt;T,T,T>_or_TAccumulate">Func is an accumulator function to be invoked on each element. Seed is the initial accumulator value.</param>
  173. /// <param name="func" type="Optional:Func&lt;TAccumulate,T,TAccumulate>" optional="true">An accumulator function to be invoked on each element.</param>
  174. /// <param name="resultSelector" type="Optional:Func&lt;TAccumulate,TResult>" optional="true">A function to transform the final accumulator value into the result value.</param>
  175. /// <returns type="Enumerable"></returns>
  176. },
  177. Select: function (selector)
  178. {
  179. /// <summary>Projects each element of a sequence into a new form.</summary>
  180. /// <param name="selector" type="Func&lt;T,T>_or_Func&lt;T,int,T>">A transform function to apply to each source element; Optional:the second parameter of the function represents the index of the source element.</param>
  181. /// <returns type="Enumerable"></returns>
  182. },
  183. SelectMany: function (collectionSelector, resultSelector)
  184. {
  185. /// <summary>Projects each element of a sequence and flattens the resulting sequences into one sequence.</summary>
  186. /// <param name="collectionSelector" type="Func&lt;T,TCollection[]>_or_Func&lt;T,int,TCollection[]>">A transform function to apply to each source element; Optional:the second parameter of the function represents the index of the source element.</param>
  187. /// <param name="resultSelector" type="Optional:Func&lt;T,TCollection,TResult>" optional="true">Optional:A transform function to apply to each element of the intermediate sequence.</param>
  188. /// <returns type="Enumerable"></returns>
  189. },
  190. Where: function (predicate)
  191. {
  192. /// <summary>Filters a sequence of values based on a predicate.</summary>
  193. /// <param name="predicate" type="Func&lt;T,bool>_or_Func&lt;T,int,bool>">A function to test each source element for a condition; Optional:the second parameter of the function represents the index of the source element.</param>
  194. /// <returns type="Enumerable"></returns>
  195. },
  196. OfType: function (type)
  197. {
  198. /// <summary>Filters the elements based on a specified type.</summary>
  199. /// <param name="type" type="T">The type to filter the elements of the sequence on.</param>
  200. /// <returns type="Enumerable"></returns>
  201. },
  202. Zip: function (second, selector)
  203. {
  204. /// <summary>Merges two sequences by using the specified predicate function.</summary>
  205. /// <param name="second" type="T[]">The second sequence to merge.</param>
  206. /// <param name="selector" type="Func&lt;TFirst,TSecond,TResult>_or_Func&lt;TFirst,TSecond,int,TResult>">A function that specifies how to merge the elements from the two sequences. Optional:the third parameter of the function represents the index of the source element.</param>
  207. /// <returns type="Enumerable"></returns>
  208. },
  209. /* Join Methods */
  210. Join: function (inner, outerKeySelector, innerKeySelector, resultSelector, compareSelector)
  211. {
  212. /// <summary>Correlates the elements of two sequences based on matching keys.</summary>
  213. /// <param name="inner" type="T[]">The sequence to join to the first sequence.</param>
  214. /// <param name="outerKeySelector" type="Func&lt;TOuter,TKey>">A function to extract the join key from each element of the first sequence.</param>
  215. /// <param name="innerKeySelector" type="Func&lt;TInner,TKey>">A function to extract the join key from each element of the second sequence.</param>
  216. /// <param name="resultSelector" type="Func&lt;TOuter,TInner,TResult>">A function to create a result element from two matching elements.</param>
  217. /// <param name="compareSelector" type="Optional:Func&lt;TKey,TCompare>" optional="true">An equality comparer to compare values.</param>
  218. /// <returns type="Enumerable"></returns>
  219. },
  220. GroupJoin: function (inner, outerKeySelector, innerKeySelector, resultSelector, compareSelector)
  221. {
  222. /// <summary>Correlates the elements of two sequences based on equality of keys and groups the results.</summary>
  223. /// <param name="inner" type="T[]">The sequence to join to the first sequence.</param>
  224. /// <param name="outerKeySelector" type="Func&lt;TOuter>">A function to extract the join key from each element of the first sequence.</param>
  225. /// <param name="innerKeySelector" type="Func&lt;TInner>">A function to extract the join key from each element of the second sequence.</param>
  226. /// <param name="resultSelector" type="Func&lt;TOuter,Enumerable&lt;TInner>,TResult">A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.</param>
  227. /// <param name="compareSelector" type="Optional:Func&lt;TKey,TCompare>" optional="true">An equality comparer to compare values.</param>
  228. /// <returns type="Enumerable"></returns>
  229. },
  230. /* Set Methods */
  231. All: function (predicate)
  232. {
  233. /// <summary>Determines whether all elements of a sequence satisfy a condition.</summary>
  234. /// <param type="Func&lt;T,bool>" name="predicate">A function to test each element for a condition.</param>
  235. /// <returns type="Boolean"></returns>
  236. },
  237. Any: function (predicate)
  238. {
  239. /// <summary>Determines whether a sequence contains any elements or any element of a sequence satisfies a condition.</summary>
  240. /// <param name="predicate" type="Optional:Func&lt;T,bool>" optional="true">A function to test each element for a condition.</param>
  241. /// <returns type="Boolean"></returns>
  242. },
  243. Concat: function (second)
  244. {
  245. /// <summary>Concatenates two sequences.</summary>
  246. /// <param name="second" type="T[]">The sequence to concatenate to the first sequence.</param>
  247. /// <returns type="Enumerable"></returns>
  248. },
  249. Insert: function (index, second)
  250. {
  251. /// <summary>Merge two sequences.</summary>
  252. /// <param name="index" type="Number" integer="true">The index of insert start position.</param>
  253. /// <param name="second" type="T[]">The sequence to concatenate to the first sequence.</param>
  254. /// <returns type="Enumerable"></returns>
  255. },
  256. Alternate: function (value)
  257. {
  258. /// <summary>Insert value to between sequence.</summary>
  259. /// <param name="value" type="T">The value of insert.</param>
  260. /// <returns type="Enumerable"></returns>
  261. },
  262. // Overload:function(value)
  263. // Overload:function(value, compareSelector)
  264. Contains: function (value, compareSelector)
  265. {
  266. /// <summary>Determines whether a sequence contains a specified element.</summary>
  267. /// <param name="value" type="T">The value to locate in the sequence.</param>
  268. /// <param name="compareSelector" type="Optional:Func&lt;T,TKey>" optional="true">An equality comparer to compare values.</param>
  269. /// <returns type="Boolean"></returns>
  270. },
  271. DefaultIfEmpty: function (defaultValue)
  272. {
  273. /// <summary>Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.</summary>
  274. /// <param name="defaultValue" type="T">The value to return if the sequence is empty.</param>
  275. /// <returns type="Enumerable"></returns>
  276. },
  277. Distinct: function (compareSelector)
  278. {
  279. /// <summary>Returns distinct elements from a sequence.</summary>
  280. /// <param name="compareSelector" type="Optional:Func&lt;T,TKey>" optional="true">An equality comparer to compare values.</param>
  281. /// <returns type="Enumerable"></returns>
  282. },
  283. Except: function (second, compareSelector)
  284. {
  285. /// <summary>Produces the set difference of two sequences.</summary>
  286. /// <param name="second" type="T[]">An T[] whose Elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.</param>
  287. /// <param name="compareSelector" type="Optional:Func&lt;T,TKey>" optional="true">An equality comparer to compare values.</param>
  288. /// <returns type="Enumerable"></returns>
  289. },
  290. Intersect: function (second, compareSelector)
  291. {
  292. /// <summary>Produces the set difference of two sequences.</summary>
  293. /// <param name="second" type="T[]">An T[] whose distinct elements that also appear in the first sequence will be returned.</param>
  294. /// <param name="compareSelector" type="Optional:Func&lt;T,TKey>" optional="true">An equality comparer to compare values.</param>
  295. /// <returns type="Enumerable"></returns>
  296. },
  297. SequenceEqual: function (second, compareSelector)
  298. {
  299. /// <summary>Determines whether two sequences are equal by comparing the elements.</summary>
  300. /// <param name="second" type="T[]">An T[] to compare to the first sequence.</param>
  301. /// <param name="compareSelector" type="Optional:Func&lt;T,TKey>" optional="true">An equality comparer to compare values.</param>
  302. /// <returns type="Enumerable"></returns>
  303. },
  304. Union: function (second, compareSelector)
  305. {
  306. /// <summary>Produces the union of two sequences.</summary>
  307. /// <param name="second" type="T[]">An T[] whose distinct elements form the second set for the union.</param>
  308. /// <param name="compareSelector" type="Optional:Func&lt;T,TKey>" optional="true">An equality comparer to compare values.</param>
  309. /// <returns type="Enumerable"></returns>
  310. },
  311. /* Ordering Methods */
  312. OrderBy: function (keySelector)
  313. {
  314. /// <summary>Sorts the elements of a sequence in ascending order according to a key.</summary>
  315. /// <param name="keySelector" type="Optional:Func&lt;T,TKey>">A function to extract a key from an element.</param>
  316. return new OrderedEnumerable();
  317. },
  318. OrderByDescending: function (keySelector)
  319. {
  320. /// <summary>Sorts the elements of a sequence in descending order according to a key.</summary>
  321. /// <param name="keySelector" type="Optional:Func&lt;T,TKey>">A function to extract a key from an element.</param>
  322. return new OrderedEnumerable();
  323. },
  324. Reverse: function ()
  325. {
  326. /// <summary>Inverts the order of the elements in a sequence.</summary>
  327. /// <returns type="Enumerable"></returns>
  328. },
  329. Shuffle: function ()
  330. {
  331. /// <summary>Shuffle sequence.</summary>
  332. /// <returns type="Enumerable"></returns>
  333. },
  334. /* Grouping Methods */
  335. GroupBy: function (keySelector, elementSelector, resultSelector, compareSelector)
  336. {
  337. /// <summary>Groups the elements of a sequence according to a specified key selector function.</summary>
  338. /// <param name="keySelector" type="Func&lt;T,TKey>">A function to extract the key for each element.</param>
  339. /// <param name="elementSelector" type="Optional:Func&lt;T,TElement>">A function to map each source element to an element in an Grouping&lt;TKey, TElement>.</param>
  340. /// <param name="resultSelector" type="Optional:Func&lt;TKey,Enumerable&lt;TElement>,TResult>">A function to create a result value from each group.</param>
  341. /// <param name="compareSelector" type="Optional:Func&lt;TKey,TCompare>" optional="true">An equality comparer to compare values.</param>
  342. /// <returns type="Enumerable"></returns>
  343. },
  344. PartitionBy: function (keySelector, elementSelector, resultSelector, compareSelector)
  345. {
  346. /// <summary>Create Group by continuation key.</summary>
  347. /// <param name="keySelector" type="Func&lt;T,TKey>">A function to extract the key for each element.</param>
  348. /// <param name="elementSelector" type="Optional:Func&lt;T,TElement>">A function to map each source element to an element in an Grouping&lt;TKey, TElement>.</param>
  349. /// <param name="resultSelector" type="Optional:Func&lt;TKey,Enumerable&lt;TElement>,TResult>">A function to create a result value from each group.</param>
  350. /// <param name="compareSelector" type="Optional:Func&lt;TKey,TCompare>" optional="true">An equality comparer to compare values.</param>
  351. /// <returns type="Enumerable"></returns>
  352. },
  353. BufferWithCount: function (count)
  354. {
  355. /// <summary>Divide by count</summary>
  356. /// <param name="count" type="Number" integer="true">integer</param>
  357. /// <returns type="Enumerable"></returns>
  358. },
  359. /* Aggregate Methods */
  360. Aggregate: function (func_or_seed, func, resultSelector)
  361. {
  362. /// <summary>Applies an accumulator function over a sequence.</summary>
  363. /// <param name="func_or_seed" type="Func&lt;T,T,T>_or_TAccumulate">Func is an accumulator function to be invoked on each element. Seed is the initial accumulator value.</param>
  364. /// <param name="func" type="Optional:Func&lt;TAccumulate,T,TAccumulate>" optional="true">An accumulator function to be invoked on each element.</param>
  365. /// <param name="resultSelector" type="Optional:Func&lt;TAccumulate,TResult>" optional="true">A function to transform the final accumulator value into the result value.</param>
  366. /// <returns type="TResult"></returns>
  367. },
  368. Average: function (selector)
  369. {
  370. /// <summary>Computes the average of a sequence.</summary>
  371. /// <param name="selector" type="Optional:Func&lt;T,Number>" optional="true">A transform function to apply to each element.</param>
  372. /// <returns type="Number"></returns>
  373. },
  374. Count: function (predicate)
  375. {
  376. /// <summary>Returns the number of elements in a sequence.</summary>
  377. /// <param name="predicate" type="Optional:Func&lt;T,Boolean>" optional="true">A function to test each element for a condition.</param>
  378. /// <returns type="Number"></returns>
  379. },
  380. Max: function (selector)
  381. {
  382. /// <summary>Returns the maximum value in a sequence</summary>
  383. /// <param name="selector" type="Optional:Func&lt;T,TKey>" optional="true">A transform function to apply to each element.</param>
  384. /// <returns type="Number"></returns>
  385. },
  386. Min: function (selector)
  387. {
  388. /// <summary>Returns the minimum value in a sequence</summary>
  389. /// <param name="selector" type="Optional:Func&lt;T,TKey>" optional="true">A transform function to apply to each element.</param>
  390. /// <returns type="Number"></returns>
  391. },
  392. MaxBy: function (keySelector)
  393. {
  394. /// <summary>Returns the maximum value in a sequence by keySelector</summary>
  395. /// <param name="keySelector" type="Func&lt;T,TKey>">A compare selector of element.</param>
  396. /// <returns type="T"></returns>
  397. },
  398. MinBy: function (keySelector)
  399. {
  400. /// <summary>Returns the minimum value in a sequence by keySelector</summary>
  401. /// <param name="keySelector" type="Func&lt;T,TKey>">A compare selector of element.</param>
  402. /// <returns type="T"></returns>
  403. },
  404. Sum: function (selector)
  405. {
  406. /// <summary>Computes the sum of a sequence of values.</summary>
  407. /// <param name="selector" type="Optional:Func&lt;T,TKey>" optional="true">A transform function to apply to each element.</param>
  408. /// <returns type="Number"></returns>
  409. },
  410. /* Paging Methods */
  411. ElementAt: function (index)
  412. {
  413. /// <summary>Returns the element at a specified index in a sequence.</summary>
  414. /// <param name="index" type="Number" integer="true">The zero-based index of the element to retrieve.</param>
  415. /// <returns type="T"></returns>
  416. },
  417. ElementAtOrDefault: function (index, defaultValue)
  418. {
  419. /// <summary>Returns the element at a specified index in a sequence or a default value if the index is out of range.</summary>
  420. /// <param name="index" type="Number" integer="true">The zero-based index of the element to retrieve.</param>
  421. /// <param name="defaultValue" type="T">The value if the index is outside the bounds then send.</param>
  422. /// <returns type="T"></returns>
  423. },
  424. First: function (predicate)
  425. {
  426. /// <summary>Returns the first element of a sequence.</summary>
  427. /// <param name="predicate" type="Optional:Func&lt;T,Boolean>">A function to test each element for a condition.</param>
  428. /// <returns type="T"></returns>
  429. },
  430. FirstOrDefault: function (defaultValue, predicate)
  431. {
  432. /// <summary>Returns the first element of a sequence, or a default value.</summary>
  433. /// <param name="defaultValue" type="T">The value if not found then send.</param>
  434. /// <param name="predicate" type="Optional:Func&lt;T,Boolean>">A function to test each element for a condition.</param>
  435. /// <returns type="T"></returns>
  436. },
  437. Last: function (predicate)
  438. {
  439. /// <summary>Returns the last element of a sequence.</summary>
  440. /// <param name="predicate" type="Optional:Func&lt;T,Boolean>">A function to test each element for a condition.</param>
  441. /// <returns type="T"></returns>
  442. },
  443. LastOrDefault: function (defaultValue, predicate)
  444. {
  445. /// <summary>Returns the last element of a sequence, or a default value.</summary>
  446. /// <param name="defaultValue" type="T">The value if not found then send.</param>
  447. /// <param name="predicate" type="Optional:Func&lt;T,Boolean>">A function to test each element for a condition.</param>
  448. /// <returns type="T"></returns>
  449. },
  450. Single: function (predicate)
  451. {
  452. /// <summary>Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.</summary>
  453. /// <param name="predicate" type="Optional:Func&lt;T,Boolean>">A function to test each element for a condition.</param>
  454. /// <returns type="T"></returns>
  455. },
  456. SingleOrDefault: function (defaultValue, predicate)
  457. {
  458. /// <summary>Returns a single, specific element of a sequence of values, or a default value if no such element is found.</summary>
  459. /// <param name="defaultValue" type="T">The value if not found then send.</param>
  460. /// <param name="predicate" type="Optional:Func&lt;T,Boolean>">A function to test each element for a condition.</param>
  461. /// <returns type="T"></returns>
  462. },
  463. Skip: function (count)
  464. {
  465. /// <summary>Bypasses a specified number of elements in a sequence and then returns the remaining elements.</summary>
  466. /// <param name="count" type="Number" integer="true">The number of elements to skip before returning the remaining elements.</param>
  467. /// <returns type="Enumerable"></returns>
  468. },
  469. SkipWhile: function (predicate)
  470. {
  471. /// <summary>Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.</summary>
  472. /// <param name="predicate" type="Func&lt;T,Boolean>_or_Func&lt;T,int,Boolean>">A function to test each source element for a condition; Optional:the second parameter of the function represents the index of the source element.</param>
  473. /// <returns type="Enumerable"></returns>
  474. },
  475. Take: function (count)
  476. {
  477. /// <summary>Returns a specified number of contiguous elements from the start of a sequence.</summary>
  478. /// <param name="count" type="Number" integer="true">The number of elements to return.</param>
  479. /// <returns type="Enumerable"></returns>
  480. },
  481. TakeWhile: function (predicate)
  482. {
  483. /// <summary>Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements.</summary>
  484. /// <param name="predicate" type="Func&lt;T,Boolean>_or_Func&lt;T,int,Boolean>">A function to test each source element for a condition; Optional:the second parameter of the function represents the index of the source element.</param>
  485. /// <returns type="Enumerable"></returns>
  486. },
  487. TakeExceptLast: function (count)
  488. {
  489. /// <summary>Take a sequence except last count.</summary>
  490. /// <param name="count" type="Optional:Number" integer="true">The number of skip count.</param>
  491. /// <returns type="Enumerable"></returns>
  492. },
  493. TakeFromLast: function (count)
  494. {
  495. /// <summary>Take a sequence from last count.</summary>
  496. /// <param name="count" type="Number" integer="true">The number of take count.</param>
  497. /// <returns type="Enumerable"></returns>
  498. },
  499. IndexOf: function (item)
  500. {
  501. /// <summary>Returns the zero-based index of the flrst occurrence of a value.</summary>
  502. /// <param name="item" type="T">The zero-based starting index of the search.</param>
  503. /// <returns type="Number" integer="true"></returns>
  504. },
  505. LastIndexOf: function (item)
  506. {
  507. /// <summary>Returns the zero-based index of the last occurrence of a value.</summary>
  508. /// <param name="item" type="T">The zero-based starting index of the search.</param>
  509. /// <returns type="Number" integer="true"></returns>
  510. },
  511. /* Convert Methods */
  512. ToArray: function ()
  513. {
  514. /// <summary>Creates an array from this sequence.</summary>
  515. /// <returns type="Array"></returns>
  516. },
  517. ToLookup: function (keySelector, elementSelector, compareSelector)
  518. {
  519. /// <summary>Creates a Lookup from this sequence.</summary>
  520. /// <param name="keySelector" type="Func&lt;T,TKey>">A function to extract a key from each element.</param>
  521. /// <param name="elementSelector" type="Optional:Func&lt;T,TElement>">A transform function to produce a result element value from each element.</param>
  522. /// <param name="compareSelector" type="Optional:Func&lt;TKey,TCompare>" optional="true">An equality comparer to compare values.</param>
  523. return new Lookup();
  524. },
  525. ToObject: function (keySelector, elementSelector)
  526. {
  527. /// <summary>Creates a Object from this sequence.</summary>
  528. /// <param name="keySelector" type="Func&lt;T,String>">A function to extract a key from each element.</param>
  529. /// <param name="elementSelector" type="Func&lt;T,TElement>">A transform function to produce a result element value from each element.</param>
  530. /// <returns type="Object"></returns>
  531. },
  532. ToDictionary: function (keySelector, elementSelector, compareSelector)
  533. {
  534. /// <summary>Creates a Dictionary from this sequence.</summary>
  535. /// <param name="keySelector" type="Func&lt;T,TKey>">A function to extract a key from each element.</param>
  536. /// <param name="elementSelector" type="Func&lt;T,TElement>">A transform function to produce a result element value from each element.</param>
  537. /// <param name="compareSelector" type="Optional:Func&lt;TKey,TCompare>" optional="true">An equality comparer to compare values.</param>
  538. return new Dictionary();
  539. },
  540. // Overload:function()
  541. // Overload:function(replacer)
  542. // Overload:function(replacer, space)
  543. ToJSON: function (replacer, space)
  544. {
  545. /// <summary>Creates a JSON String from sequence, performed only native JSON support browser or included json2.js.</summary>
  546. /// <param name="replacer" type="Optional:Func">a replacer.</param>
  547. /// <param name="space" type="Optional:Number">indent spaces.</param>
  548. /// <returns type="String"></returns>
  549. },
  550. // Overload:function()
  551. // Overload:function(separator)
  552. // Overload:function(separator,selector)
  553. ToString: function (separator, selector)
  554. {
  555. /// <summary>Creates Joined string from this sequence.</summary>
  556. /// <param name="separator" type="Optional:String">A String.</param>
  557. /// <param name="selector" type="Optional:Func&lt;T,String>">A transform function to apply to each source element.</param>
  558. /// <returns type="String"></returns>
  559. },
  560. /* Action Methods */
  561. Do: function (action)
  562. {
  563. /// <summary>Performs the specified action on each element of the sequence.</summary>
  564. /// <param name="action" type="Action&lt;T>_or_Action&lt;T,int>">Optional:the second parameter of the function represents the index of the source element.</param>
  565. /// <returns type="Enumerable"></returns>
  566. },
  567. ForEach: function (action)
  568. {
  569. /// <summary>Performs the specified action on each element of the sequence.</summary>
  570. /// <param name="action" type="Action&lt;T>_or_Action&lt;T,int>">[return true;]continue iteration.[return false;]break iteration. Optional:the second parameter of the function represents the index of the source element.</param>
  571. /// <returns type="void"></returns>
  572. },
  573. Write: function (separator, selector)
  574. {
  575. /// <summary>Do document.write.</summary>
  576. /// <param name="separator" type="Optional:String">A String.</param>
  577. /// <param name="selector" type="Optional:Func&lt;T,String>">A transform function to apply to each source element.</param>
  578. /// <returns type="void"></returns>
  579. },
  580. WriteLine: function (selector)
  581. {
  582. /// <summary>Do document.write + &lt;br />.</summary>
  583. /// <param name="selector" type="Optional:Func&lt;T,String>">A transform function to apply to each source element.</param>
  584. /// <returns type="void"></returns>
  585. },
  586. Force: function ()
  587. {
  588. /// <summary>Execute enumerate.</summary>
  589. /// <returns type="void"></returns>
  590. },
  591. /* Functional Methods */
  592. Let: function (func)
  593. {
  594. /// <summary>Bind the source to the parameter so that it can be used multiple times.</summary>
  595. /// <param name="func" type="Func&lt;Enumerable&lt;T>,Enumerable&lt;TR>>">apply function.</param>
  596. /// <returns type="Enumerable"></returns>
  597. },
  598. Share: function ()
  599. {
  600. /// <summary>Shares cursor of all enumerators to the sequence.</summary>
  601. /// <returns type="Enumerable"></returns>
  602. },
  603. MemoizeAll: function ()
  604. {
  605. /// <summary>Creates an enumerable that enumerates the original enumerable only once and caches its results.</summary>
  606. /// <returns type="Enumerable"></returns>
  607. },
  608. /* Error Handling Methods */
  609. Catch: function (handler)
  610. {
  611. /// <summary>catch error and do handler.</summary>
  612. /// <param name="handler" type="Action&lt;Error>">execute if error occured.</param>
  613. /// <returns type="Enumerable"></returns>
  614. },
  615. Finally: function (finallyAction)
  616. {
  617. /// <summary>do action if enumerate end or disposed or error occured.</summary>
  618. /// <param name="handler" type="Action">finally execute.</param>
  619. /// <returns type="Enumerable"></returns>
  620. },
  621. /* For Debug Methods */
  622. Trace: function (message, selector)
  623. {
  624. /// <summary>Trace object use console.log.</summary>
  625. /// <param name="message" type="Optional:String">Default is 'Trace:'.</param>
  626. /// <param name="selector" type="Optional:Func&lt;T,String>">A transform function to apply to each source element.</param>
  627. /// <returns type="Enumerable"></returns>
  628. }
  629. }
  630. // vsdoc-dummy
  631. Enumerable.prototype.GetEnumerator = function ()
  632. {
  633. /// <summary>Returns an enumerator that iterates through the collection.</summary>
  634. return new IEnumerator();
  635. }
  636. var IEnumerator = function () { }
  637. IEnumerator.prototype.Current = function ()
  638. {
  639. /// <summary>Gets the element in the collection at the current position of the enumerator.</summary>
  640. /// <returns type="T"></returns>
  641. }
  642. IEnumerator.prototype.MoveNext = function ()
  643. {
  644. /// <summary>Advances the enumerator to the next element of the collection.</summary>
  645. /// <returns type="Boolean"></returns>
  646. }
  647. IEnumerator.prototype.Dispose = function ()
  648. {
  649. /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>
  650. /// <returns type="Void"></returns>
  651. }
  652. var Dictionary = function () { }
  653. Dictionary.prototype =
  654. {
  655. Add: function (key, value)
  656. {
  657. /// <summary>add new pair. if duplicate key then overwrite new value.</summary>
  658. /// <returns type="Void"></returns>
  659. },
  660. Get: function (key)
  661. {
  662. /// <summary>get value. if not find key then return undefined.</summary>
  663. /// <returns type="T"></returns>
  664. },
  665. Set: function (key, value)
  666. {
  667. /// <summary>set value. if complete set value then return true, not find key then return false.</summary>
  668. /// <returns type="Boolean"></returns>
  669. },
  670. Contains: function (key)
  671. {
  672. /// <summary>check contains key.</summary>
  673. /// <returns type="Boolean"></returns>
  674. },
  675. Clear: function ()
  676. {
  677. /// <summary>clear dictionary.</summary>
  678. /// <returns type="Void"></returns>
  679. },
  680. Remove: function (key)
  681. {
  682. /// <summary>remove key and value.</summary>
  683. /// <returns type="Void"></returns>
  684. },
  685. Count: function ()
  686. {
  687. /// <summary>contains value's count.</summary>
  688. /// <returns type="Number"></returns>
  689. },
  690. ToEnumerable: function ()
  691. {
  692. /// <summary>Convert to Enumerable&lt;{Key:, Value:}&gt;.</summary>
  693. /// <returns type="Enumerable"></returns>
  694. }
  695. }
  696. var Lookup = function () { }
  697. Lookup.prototype =
  698. {
  699. Count: function ()
  700. {
  701. /// <summary>contains value's count.</summary>
  702. /// <returns type="Number"></returns>
  703. },
  704. Get: function (key)
  705. {
  706. /// <summary>get grouped enumerable.</summary>
  707. /// <returns type="Enumerable"></returns>
  708. },
  709. Contains: function (key)
  710. {
  711. /// <summary>check contains key.</summary>
  712. /// <returns type="Boolean"></returns>
  713. },
  714. ToEnumerable: function ()
  715. {
  716. /// <summary>Convert to Enumerable&lt;Grouping&gt;.</summary>
  717. /// <returns type="Enumerable"></returns>
  718. }
  719. }
  720. var Grouping = function () { }
  721. Grouping.prototype = new Enumerable();
  722. Grouping.prototype.Key = function ()
  723. {
  724. /// <summary>get grouping key.</summary>
  725. /// <returns type="T"></returns>
  726. }
  727. var OrderedEnumerable = function () { }
  728. OrderedEnumerable.prototype = new Enumerable();
  729. OrderedEnumerable.prototype.ThenBy = function (keySelector)
  730. {
  731. /// <summary>Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.</summary>
  732. /// <param name="keySelector" type="Func&lt;T,TKey>">A function to extract a key from each element.</param>
  733. return Enumerable.Empty().OrderBy();
  734. }
  735. OrderedEnumerable.prototype.ThenByDescending = function (keySelector)
  736. {
  737. /// <summary>Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.</summary>
  738. /// <param name="keySelector" type="Func&lt;T,TKey>">A function to extract a key from each element.</param>
  739. return Enumerable.Empty().OrderBy();
  740. }
  741. return Enumerable;
  742. })()