699 lines
28 KiB
HTML
699 lines
28 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Class LINQExtensions | CapyKit Documentation </title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="title" content="Class LINQExtensions | CapyKit Documentation ">
|
|
|
|
<meta name="description" content="Provides static extension methods for performing common LINQ operations on and collections.">
|
|
<link rel="icon" href="../favicon.ico">
|
|
<link rel="stylesheet" href="../public/docfx.min.css">
|
|
<link rel="stylesheet" href="../public/main.css">
|
|
<meta name="docfx:navrel" content="../toc.html">
|
|
<meta name="docfx:tocrel" content="toc.html">
|
|
|
|
<meta name="docfx:rel" content="../">
|
|
|
|
|
|
|
|
<meta name="loc:inThisArticle" content="In this article">
|
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
|
<meta name="loc:tocFilter" content="Filter by title">
|
|
<meta name="loc:nextArticle" content="Next">
|
|
<meta name="loc:prevArticle" content="Previous">
|
|
<meta name="loc:themeLight" content="Light">
|
|
<meta name="loc:themeDark" content="Dark">
|
|
<meta name="loc:themeAuto" content="Auto">
|
|
<meta name="loc:changeTheme" content="Change theme">
|
|
<meta name="loc:copy" content="Copy">
|
|
<meta name="loc:downloadPdf" content="Download PDF">
|
|
|
|
<script type="module" src="./../public/docfx.min.js"></script>
|
|
|
|
<script>
|
|
const theme = localStorage.getItem('theme') || 'auto'
|
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
|
<header class="bg-body border-bottom">
|
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
|
<div class="container-xxl flex-nowrap">
|
|
<a class="navbar-brand" href="../index.html">
|
|
<img id="logo" class="svg" src="../logo.svg" alt="CapyKit Documentation">
|
|
CapyKit Documentation
|
|
</a>
|
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
|
<i class="bi bi-three-dots"></i>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navpanel">
|
|
<div id="navbar">
|
|
<form class="search" role="search" id="search">
|
|
<i class="bi bi-search"></i>
|
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<main class="container-xxl">
|
|
<div class="toc-offcanvas">
|
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
|
<div class="offcanvas-header">
|
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
|
</div>
|
|
<div class="offcanvas-body">
|
|
<nav class="toc" id="toc"></nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content">
|
|
<div class="actionbar">
|
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
|
<i class="bi bi-list"></i>
|
|
</button>
|
|
|
|
<nav id="breadcrumb"></nav>
|
|
</div>
|
|
|
|
<article data-uid="CapyKit.Extensions.LINQExtensions">
|
|
|
|
|
|
|
|
<h1 id="CapyKit_Extensions_LINQExtensions" data-uid="CapyKit.Extensions.LINQExtensions" class="text-break">
|
|
Class LINQExtensions
|
|
</h1>
|
|
|
|
<div class="facts text-secondary">
|
|
<dl><dt>Namespace</dt><dd><a class="xref" href="CapyKit.html">CapyKit</a>.<a class="xref" href="CapyKit.Extensions.html">Extensions</a></dd></dl>
|
|
<dl><dt>Assembly</dt><dd>CapyKit.dll</dd></dl>
|
|
</div>
|
|
|
|
<div class="markdown summary"><p>Provides static extension methods for performing common LINQ operations on <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable<T></a> and <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.iqueryable-1">IQueryable<T></a> collections.</p>
|
|
</div>
|
|
<div class="markdown conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static class LINQExtensions</code></pre>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<dl class="typelist inheritance">
|
|
<dt>Inheritance</dt>
|
|
<dd>
|
|
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
|
<div><span class="xref">LINQExtensions</span></div>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
<dl class="typelist inheritedMembers">
|
|
<dt>Inherited Members</dt>
|
|
<dd>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
|
</div>
|
|
<div>
|
|
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2 class="section" id="methods">Methods
|
|
</h2>
|
|
|
|
|
|
<a id="CapyKit_Extensions_LINQExtensions_Distinct_" data-uid="CapyKit.Extensions.LINQExtensions.Distinct*"></a>
|
|
|
|
<h3 id="CapyKit_Extensions_LINQExtensions_Distinct__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__" data-uid="CapyKit.Extensions.LINQExtensions.Distinct``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1})">
|
|
Distinct<T, U>(IEnumerable<T>, Func<T, U>)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Enumerates distinct items in this collection as defined by the key <code class="paramref">property</code>.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static IEnumerable<T> Distinct<T, U>(this IEnumerable<T> items, Func<T, U> property)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>items</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><T></dt>
|
|
<dd><p>The items to act on.</p>
|
|
</dd>
|
|
<dt><code>property</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a><T, U></dt>
|
|
<dd><p>The property.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><T></dt>
|
|
<dd><p>An enumerator that allows foreach to be used to process distinct items in this collection.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Generic type parameter of the parent object.</p>
|
|
</dd>
|
|
<dt><code>U</code></dt>
|
|
<dd><p>Generic type parameter property value.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="CapyKit_Extensions_LINQExtensions_Filter_" data-uid="CapyKit.Extensions.LINQExtensions.Filter*"></a>
|
|
|
|
<h3 id="CapyKit_Extensions_LINQExtensions_Filter__1_System_Collections_Generic_IEnumerable___0__System_Func___0_System_Boolean__" data-uid="CapyKit.Extensions.LINQExtensions.Filter``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Boolean})">
|
|
Filter<T>(IEnumerable<T>, Func<T, bool>)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Filters out items matching a <code class="paramref">predicate</code> from the collection.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static IEnumerable<T> Filter<T>(this IEnumerable<T> source, Func<T, bool> predicate)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>source</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><T></dt>
|
|
<dd><p>The source to act on.</p>
|
|
</dd>
|
|
<dt><code>predicate</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a><T, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>></dt>
|
|
<dd><p>The predicate.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><T></dt>
|
|
<dd><p>An enumerator that allows foreach to be used to process remove in this collection.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Generic type parameter.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="CapyKit_Extensions_LINQExtensions_Filter_" data-uid="CapyKit.Extensions.LINQExtensions.Filter*"></a>
|
|
|
|
<h3 id="CapyKit_Extensions_LINQExtensions_Filter__1_System_Linq_IQueryable___0__System_Linq_Expressions_Expression_System_Func___0_System_Boolean___" data-uid="CapyKit.Extensions.LINQExtensions.Filter``1(System.Linq.IQueryable{``0},System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}})">
|
|
Filter<T>(IQueryable<T>, Expression<Func<T, bool>>)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Filters out items matching a <code class="paramref">predicate</code> from the collection.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static IQueryable<T> Filter<T>(this IQueryable<T> source, Expression<Func<T, bool>> predicate)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>source</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.iqueryable-1">IQueryable</a><T></dt>
|
|
<dd><p>The source to act on.</p>
|
|
</dd>
|
|
<dt><code>predicate</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1">Expression</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a><T, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>>></dt>
|
|
<dd><p>The predicate.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.iqueryable-1">IQueryable</a><T></dt>
|
|
<dd><p>An enumerator that allows foreach to be used to process remove in this collection.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Generic type parameter.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="CapyKit_Extensions_LINQExtensions_LeftOuterJoin_" data-uid="CapyKit.Extensions.LINQExtensions.LeftOuterJoin*"></a>
|
|
|
|
<h3 id="CapyKit_Extensions_LINQExtensions_LeftOuterJoin__4_System_Collections_Generic_IEnumerable___0__System_Collections_Generic_IEnumerable___1__System_Func___0___2__System_Func___1___2__System_Func___0_System_Collections_Generic_IEnumerable___1____3__System_Func___0___1__" data-uid="CapyKit.Extensions.LINQExtensions.LeftOuterJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,System.Collections.Generic.IEnumerable{``1},``3},System.Func{``0,``1})">
|
|
LeftOuterJoin<T, U, TKey, R>(IEnumerable<T>, IEnumerable<U>, Func<T, TKey>, Func<U, TKey>, Func<T, IEnumerable<U>, R>, Func<T, U>)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>An IEnumable<T> extension method that left outer join.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static IEnumerable<R> LeftOuterJoin<T, U, TKey, R>(this IEnumerable<T> source, IEnumerable<U> inner, Func<T, TKey> outerSelector, Func<U, TKey> innerSelector, Func<T, IEnumerable<U>, R> resultSelector, Func<T, U> defaultGenerator = null)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>source</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><T></dt>
|
|
<dd><p>The source to act on.</p>
|
|
</dd>
|
|
<dt><code>inner</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><U></dt>
|
|
<dd><p>The inner.</p>
|
|
</dd>
|
|
<dt><code>outerSelector</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a><T, TKey></dt>
|
|
<dd><p>The outer selector.</p>
|
|
</dd>
|
|
<dt><code>innerSelector</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a><U, TKey></dt>
|
|
<dd><p>The inner selector.</p>
|
|
</dd>
|
|
<dt><code>resultSelector</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a><T, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><U>, R></dt>
|
|
<dd><p>The result selector.</p>
|
|
</dd>
|
|
<dt><code>defaultGenerator</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a><T, U></dt>
|
|
<dd><p>(Optional) The default generator.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><R></dt>
|
|
<dd><p>An enumerator that allows foreach to be used to process left outter join in this collection.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Generic type parameter.</p>
|
|
</dd>
|
|
<dt><code>U</code></dt>
|
|
<dd><p>Generic type parameter.</p>
|
|
</dd>
|
|
<dt><code>TKey</code></dt>
|
|
<dd><p>Type of the key.</p>
|
|
</dd>
|
|
<dt><code>R</code></dt>
|
|
<dd><p>Type of the r.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="CapyKit_Extensions_LINQExtensions_LeftOuterJoin_" data-uid="CapyKit.Extensions.LINQExtensions.LeftOuterJoin*"></a>
|
|
|
|
<h3 id="CapyKit_Extensions_LINQExtensions_LeftOuterJoin__4_System_Linq_IQueryable___0__System_Linq_IQueryable___1__System_Linq_Expressions_Expression_System_Func___0___2___System_Linq_Expressions_Expression_System_Func___1___2___System_Func___0_System_Collections_Generic_IEnumerable___1____3__System_Func___0___1__" data-uid="CapyKit.Extensions.LINQExtensions.LeftOuterJoin``4(System.Linq.IQueryable{``0},System.Linq.IQueryable{``1},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.Linq.Expressions.Expression{System.Func{``1,``2}},System.Func{``0,System.Collections.Generic.IEnumerable{``1},``3},System.Func{``0,``1})">
|
|
LeftOuterJoin<T, U, TKey, R>(IQueryable<T>, IQueryable<U>, Expression<Func<T, TKey>>, Expression<Func<U, TKey>>, Func<T, IEnumerable<U>, R>, Func<T, U>)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>An IQueryable<T> extension method that left outer join.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static IQueryable<R> LeftOuterJoin<T, U, TKey, R>(this IQueryable<T> source, IQueryable<U> inner, Expression<Func<T, TKey>> outerSelector, Expression<Func<U, TKey>> innerSelector, Func<T, IEnumerable<U>, R> resultSelector, Func<T, U> defaultGenerator = null)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>source</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.iqueryable-1">IQueryable</a><T></dt>
|
|
<dd><p>The source to act on.</p>
|
|
</dd>
|
|
<dt><code>inner</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.iqueryable-1">IQueryable</a><U></dt>
|
|
<dd><p>The inner.</p>
|
|
</dd>
|
|
<dt><code>outerSelector</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1">Expression</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a><T, TKey>></dt>
|
|
<dd><p>The outer selector.</p>
|
|
</dd>
|
|
<dt><code>innerSelector</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1">Expression</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a><U, TKey>></dt>
|
|
<dd><p>The inner selector.</p>
|
|
</dd>
|
|
<dt><code>resultSelector</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a><T, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><U>, R></dt>
|
|
<dd><p>The result selector.</p>
|
|
</dd>
|
|
<dt><code>defaultGenerator</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a><T, U></dt>
|
|
<dd><p>(Optional) The default generator.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.iqueryable-1">IQueryable</a><R></dt>
|
|
<dd><p>An IQueryable<R></p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Generic type parameter.</p>
|
|
</dd>
|
|
<dt><code>U</code></dt>
|
|
<dd><p>Generic type parameter.</p>
|
|
</dd>
|
|
<dt><code>TKey</code></dt>
|
|
<dd><p>Type of the key.</p>
|
|
</dd>
|
|
<dt><code>R</code></dt>
|
|
<dd><p>Type of the r.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a id="CapyKit_Extensions_LINQExtensions_PageCount_" data-uid="CapyKit.Extensions.LINQExtensions.PageCount*"></a>
|
|
|
|
<h3 id="CapyKit_Extensions_LINQExtensions_PageCount__1_System_Collections_Generic_IEnumerable___0__System_Int32_" data-uid="CapyKit.Extensions.LINQExtensions.PageCount``1(System.Collections.Generic.IEnumerable{``0},System.Int32)">
|
|
PageCount<T>(IEnumerable<T>, int)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>The number of pages of <code class="paramref">pageSize</code> size in the given collection.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static int PageCount<T>(this IEnumerable<T> source, int pageSize)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>source</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><T></dt>
|
|
<dd><p>The source to act on.</p>
|
|
</dd>
|
|
<dt><code>pageSize</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
|
<dd><p>Size of the page.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
|
<dd><p>An int.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Generic type parameter.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h4 class="section">Exceptions</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></dt>
|
|
<dd><p>Thrown when <code class="paramref">pageSize</code> is less than <code>1</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
<a id="CapyKit_Extensions_LINQExtensions_PageCount_" data-uid="CapyKit.Extensions.LINQExtensions.PageCount*"></a>
|
|
|
|
<h3 id="CapyKit_Extensions_LINQExtensions_PageCount__1_System_Linq_IQueryable___0__System_Int32_" data-uid="CapyKit.Extensions.LINQExtensions.PageCount``1(System.Linq.IQueryable{``0},System.Int32)">
|
|
PageCount<T>(IQueryable<T>, int)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>The number of pages of <code class="paramref">pageSize</code> size in the given collection.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static int PageCount<T>(this IQueryable<T> source, int pageSize)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>source</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.iqueryable-1">IQueryable</a><T></dt>
|
|
<dd><p>The source to act on.</p>
|
|
</dd>
|
|
<dt><code>pageSize</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
|
<dd><p>Size of the page.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
|
<dd><p>An int.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Generic type parameter.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h4 class="section">Exceptions</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></dt>
|
|
<dd><p>Thrown when <code class="paramref">pageSize</code> is less than <code>1</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
<a id="CapyKit_Extensions_LINQExtensions_Page_" data-uid="CapyKit.Extensions.LINQExtensions.Page*"></a>
|
|
|
|
<h3 id="CapyKit_Extensions_LINQExtensions_Page__1_System_Collections_Generic_IEnumerable___0__System_Int32_System_Int32_" data-uid="CapyKit.Extensions.LINQExtensions.Page``1(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Int32)">
|
|
Page<T>(IEnumerable<T>, int, int)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Get a page of items from a collection, skipping <code class="paramref">pageNumber</code> pages of
|
|
<code class="paramref">pageSize</code> items per page.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static IEnumerable<T> Page<T>(this IEnumerable<T> source, int pageNumber, int pageSize)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>source</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><T></dt>
|
|
<dd><p>The source to act on.</p>
|
|
</dd>
|
|
<dt><code>pageNumber</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
|
<dd><p>The page number to retrieve.</p>
|
|
</dd>
|
|
<dt><code>pageSize</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
|
<dd><p>Number of items per page.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a><T></dt>
|
|
<dd><p>An enumerator that allows foreach to be used to process page in this collection.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Generic type parameter.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h4 class="section" id="CapyKit_Extensions_LINQExtensions_Page__1_System_Collections_Generic_IEnumerable___0__System_Int32_System_Int32__remarks">Remarks</h4>
|
|
<div class="markdown level1 remarks"><p>This method uses natural numbering starting at page 1.</p>
|
|
</div>
|
|
|
|
<h4 class="section">Exceptions</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></dt>
|
|
<dd><p>Thrown when <code class="paramref">pageNumber</code> is less than <code>1</code> or if
|
|
<code class="paramref">pageSize</code> is less than
|
|
<code>1</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
<a id="CapyKit_Extensions_LINQExtensions_Page_" data-uid="CapyKit.Extensions.LINQExtensions.Page*"></a>
|
|
|
|
<h3 id="CapyKit_Extensions_LINQExtensions_Page__1_System_Linq_IQueryable___0__System_Int32_System_Int32_" data-uid="CapyKit.Extensions.LINQExtensions.Page``1(System.Linq.IQueryable{``0},System.Int32,System.Int32)">
|
|
Page<T>(IQueryable<T>, int, int)
|
|
|
|
</h3>
|
|
|
|
<div class="markdown level1 summary"><p>Get a page of items from a collection, skipping <code class="paramref">pageNumber</code> pages of
|
|
<code class="paramref">pageSize</code> items per page.</p>
|
|
</div>
|
|
<div class="markdown level1 conceptual"></div>
|
|
|
|
<div class="codewrapper">
|
|
<pre><code class="lang-csharp hljs">public static IQueryable<T> Page<T>(this IQueryable<T> source, int pageNumber, int pageSize)</code></pre>
|
|
</div>
|
|
|
|
<h4 class="section">Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>source</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.iqueryable-1">IQueryable</a><T></dt>
|
|
<dd><p>The source to act on.</p>
|
|
</dd>
|
|
<dt><code>pageNumber</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
|
<dd><p>The page number to retrieve.</p>
|
|
</dd>
|
|
<dt><code>pageSize</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
|
<dd><p>.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Returns</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.iqueryable-1">IQueryable</a><T></dt>
|
|
<dd><p>An enumerator that allows foreach to be used to process page in this collection.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h4 class="section">Type Parameters</h4>
|
|
<dl class="parameters">
|
|
<dt><code>T</code></dt>
|
|
<dd><p>Generic type parameter.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h4 class="section" id="CapyKit_Extensions_LINQExtensions_Page__1_System_Linq_IQueryable___0__System_Int32_System_Int32__remarks">Remarks</h4>
|
|
<div class="markdown level1 remarks"><p>This method uses natural numbering starting at page 1.</p>
|
|
</div>
|
|
|
|
<h4 class="section">Exceptions</h4>
|
|
<dl class="parameters">
|
|
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></dt>
|
|
<dd><p>Thrown when <code class="paramref">pageNumber</code> is less than <code>1</code> or if
|
|
<code class="paramref">pageSize</code> is less than
|
|
<code>1</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
</article>
|
|
|
|
<div class="contribution d-print-none">
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="affix">
|
|
<nav id="affix"></nav>
|
|
</div>
|
|
</main>
|
|
|
|
<div class="container-xxl search-results" id="search-results"></div>
|
|
|
|
<footer class="border-top text-secondary">
|
|
<div class="container-xxl">
|
|
<div class="flex-fill">
|
|
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|