KingNET.WebUI/Scripts/linqjs/sample/LinqJS.cs

(开头部分) 12KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// Ms-PL License
// linq.js C# backport
// http://linqjs.codeplex.com/

using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace System.Linq
{
    public static class LinqJS
    {
        #region Generating Methods

        public static IEnumerable<T> Choice<T>(params T[] values)
        {
            var rand = new Random();
            while (true)
            {
                yield return values[rand.Next(values.Length)];
            }
        }

        public static IEnumerable<T> Cycle<T>(params T[] values)
        {
            while (true)
            {
                foreach (var item in values)
                {
                    yield return item;
                }
            }
        }

        public static IEnumerable<int> Range(int start, int count)
        {
            return Range(start, count, 1);
        }

        public static IEnumerable<int> Range(int start, int count, int step)
        {
            return ToInfinity(start, step).Take(count);
        }

        public static IEnumerable<int> RangeDown(int start, int count)
        {
            return RangeDown(start, count, 1);
        }

        public static IEnumerable<int> RangeDown(int start, int count, int step)
        {
            return ToNegativeInfinity(start, step).Take(count);
        }

        public static IEnumerable<int> RangeTo(int from, int to)
        {
            return RangeTo(from, to, 1);
        }

        public static IEnumerable<int> RangeTo(int from, int to, int step)
后面还有 366 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。