当前位置: 首页>>代码示例>>C#>>正文


C# System.Skip方法代码示例

本文整理汇总了C#中System.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# System.Skip方法的具体用法?C# System.Skip怎么用?C# System.Skip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


在下文中一共展示了System.Skip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    public static void Main () {
        var ints = new[] { 1, 2, 3, 4 };

        Console.WriteLine(ints.Last());

        Console.WriteLine(ints.Last((i) => i < 3));

        // Test the non-IList path
        Console.WriteLine(ints.Skip(1).Last());

        Console.WriteLine(ints.Skip(1).Last((i) => i < 3));
    }
开发者ID:cbsistem,项目名称:JSIL,代码行数:12,代码来源:EnumerableLast.cs

示例2: EmptySequenceIsReturnedWhenSourceContainsFewerThanCountElements

        public void EmptySequenceIsReturnedWhenSourceContainsFewerThanCountElements()
        {
            var source = new[] { 1 };
            var result = source.Skip(2);

            Assert.That(result, Is.EqualTo(Enumerable.Empty<Int32>()));
        }
开发者ID:kawillia,项目名称:LinqToObjects,代码行数:7,代码来源:SkipTests.cs

示例3: AdjacentElements

 public void AdjacentElements()
 {
     IEnumerableWithCount<string> elements = new[] { "a", "b", "c", "d", "e" }.AsEnumerableWithCount();
     IEnumerableWithCount<string> query = elements.Zip(elements.Skip(1), (x, y) => x + y);
     Assert.AreEqual(4, query.Count);
     query.AssertSequenceEqual("ab", "bc", "cd", "de");
 }
开发者ID:jamesmanning,项目名称:IEnumerableWithCount,代码行数:7,代码来源:ZipTest.cs

示例4: E_SlicingArrays

        public void E_SlicingArrays()
        {
            var array = new[] { "peanut", "butter", "and", "jelly" };

            Assert.AreEqual(new string[] { (string)FILL_ME_IN, (string)FILL_ME_IN }, array.Take(2).ToArray());
            Assert.AreEqual(new string[] { (string)FILL_ME_IN, (string)FILL_ME_IN }, array.Skip(1).Take(2).ToArray());
        }
开发者ID:halimakoundi,项目名称:CSharpKoan,代码行数:7,代码来源:G_AboutArrays.cs

示例5: Main

    public static void Main () {
        var ints = new[] { 1, 2, 3, 4 };

        foreach (var i in ints.Skip(2))
            Console.WriteLine(i);

    }
开发者ID:cbsistem,项目名称:JSIL,代码行数:7,代码来源:EnumerableSkip.cs

示例6: ReadSubItems

 private void ReadSubItems(System.Xml.XmlReader reader, ArrayList result, bool securityTrimmingEnabled)
 {
     int depth = reader.Depth + 1;
     while (reader.Read())
     {
         if (reader.Depth == depth)
         {
             if (reader.NodeType == System.Xml.XmlNodeType.Element)
             {
                 var aResult = ReadResult(reader, securityTrimmingEnabled);
                 if (aResult != null)
                     result.Add(aResult);
             }
             else if (reader.NodeType == XmlNodeType.EndElement)
             {
             }
         }
         else if (reader.Depth > depth)
         {
             reader.Skip();
         }
         else if (reader.Depth < depth)
         {
             break;
         }
     }
 }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:27,代码来源:CategoryLinkAdapter.cs

示例7: while

        void IFlickrParsable.Load(System.Xml.XmlReader reader)
        {
            reader.Read();

            while (reader.LocalName != "auth")
            {
                switch (reader.LocalName)
                {
                    case "token":
                        Token = reader.ReadElementContentAsString();
                        break;
                    case "perms":
                        Permissions = (AuthLevel)Enum.Parse(typeof(AuthLevel), reader.ReadElementContentAsString(), true);
                        break;
                    case "user":
                        User = new FoundUser();
                        ((IFlickrParsable)User).Load(reader);
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        reader.Skip();
                        break;
                }
            }
        }
开发者ID:liquidboy,项目名称:X,代码行数:25,代码来源:Auth.cs

示例8: Load

        void IFlickrParsable.Load(System.Xml.XmlReader reader)
        {
            Load(reader, false);

            if (reader.LocalName != "stats")
            {
                UtilityMethods.CheckParsingException(reader);
            }

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "views":
                        StatViews = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                        break;
                    case "comments":
                        StatComments = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                        break;
                    case "favorites":
                        StatFavorites = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            reader.Read();

            if (reader.LocalName == "description")
                Description = reader.ReadElementContentAsString();

            reader.Skip();
        }
开发者ID:liquidboy,项目名称:X,代码行数:35,代码来源:PopularPhoto.cs

示例9: ReadFromStreamWithDefaultColumnsShouldHandleFirstRowAsRowData

        public void ReadFromStreamWithDefaultColumnsShouldHandleFirstRowAsRowData()
        {
            DataTableBuilder builder = new DataTableBuilder();
            var stream = new MemoryStream();
            var sw = new StreamWriter(stream);
            var rows = new[] { "first,row,is,data", "second,row,is,johnny", "second,row,was,laura", };
            foreach (var row in rows)
            {
                sw.WriteLine(row);
            }

            sw.Flush();
            stream.Seek(0, SeekOrigin.Begin);
            try
            {
                var lazy = builder.ReadLazy(stream, rows[0].Split(','));
                Assert.Equal(rows[0].Split(','), lazy.ColumnNames);
                var rowEnumerator = rows.Skip(0).GetEnumerator();
                rowEnumerator.MoveNext();
                var rowCount = 0;
                foreach (var row in lazy.Rows)
                {
                    Assert.Equal(rowEnumerator.Current, string.Join(",", row.Values));
                    rowEnumerator.MoveNext();
                    rowCount++;
                }

                Assert.Equal(rows.Length, rowCount);
            }
            finally
            {
                sw.Dispose();
                stream.Dispose();
            }
        }
开发者ID:aaronhoffman,项目名称:DataTable,代码行数:35,代码来源:ReaderTests.cs

示例10: while

        void IFlickrParsable.Load(System.Xml.XmlReader reader)
        {
            if (reader.LocalName != "referrer")
                UtilityMethods.CheckParsingException(reader);

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "url":
                        Url = reader.Value;
                        break;
                    case "searchterm":
                        SearchTerm = reader.Value;
                        break;
                    case "views":
                        Views = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            reader.Skip();
        }
开发者ID:liquidboy,项目名称:X,代码行数:26,代码来源:StatReferrer.cs

示例11: while

        void IFlickrParsable.Load(System.Xml.XmlReader reader)
        {
            if (reader.LocalName != "stats")
            {
                UtilityMethods.CheckParsingException(reader);
            }

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "views":
                        Views = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                        break;
                    case "comments":
                        Comments = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                        break;
                    case "favorites":
                        Favorites = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            reader.Skip();
        }
开发者ID:liquidboy,项目名称:X,代码行数:28,代码来源:Stats.cs

示例12: while

        void IFlickrParsable.Load(System.Xml.XmlReader reader)
        {
            if (reader.LocalName != "place_type")
                UtilityMethods.CheckParsingException(reader);

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "place_type_id":
                    case "id":
                        Id = reader.ReadContentAsInt();
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            reader.Read();

            Name = reader.ReadContentAsString();

            reader.Skip();
        }
开发者ID:liquidboy,项目名称:X,代码行数:25,代码来源:PlaceTypeInfo.cs

示例13: Skip_SkipsItems

 public void Skip_SkipsItems()
 {
     var orderedQueryable = new[] { "1", "3", "6", "2", "8" }.AsQueryable().OrderBy(i => i);
     var orderedSource = new OrderedSource<string>(orderedQueryable);
     var expected = orderedQueryable.Skip(2).ToList();
     var actual = orderedSource.Skip(2).ToList();
     CollectionAssert.AreEquivalent(expected, actual);
 }
开发者ID:hoppersoft,项目名称:Pagination,代码行数:8,代码来源:OrderedSourceTests.cs

示例14: AllElementsOfSourceAreYieldedWhenCountIsLessThanOrEqualToZero

        public void AllElementsOfSourceAreYieldedWhenCountIsLessThanOrEqualToZero()
        {
            var source = new[] { 1 };
            var result = source.Skip(0);
            var expected = new[] { 1 };

            Assert.That(result, Is.EqualTo(expected));
        }
开发者ID:kawillia,项目名称:LinqToObjects,代码行数:8,代码来源:SkipTests.cs

示例15: ElementsBeforeCountAreSkipped

        public void ElementsBeforeCountAreSkipped()
        {
            var source = new[] { 1, 2, 3, 4, 5 };
            var result = source.Skip(3);
            var expected = new[] { 4, 5 };

            Assert.That(result, Is.EqualTo(expected));
        }
开发者ID:kawillia,项目名称:LinqToObjects,代码行数:8,代码来源:SkipTests.cs


注:本文中的System.Skip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。