HiNC-2025-win-desktop-Deploy/App/wwwroot/HiAPI-docsite/api/Hi.Common.Collections.ListUtil.html
2025-12-29 11:56:30 +08:00

2129 lines
94 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class ListUtil | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class ListUtil | HiAPI-C# 2025 ">
<meta name="description" content="Provides utility methods for working with lists and collections.">
<link rel="icon" href="../img/HiAPI.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 &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<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="../img/HiAPI.logo.png" alt="">
</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="Hi.Common.Collections.ListUtil">
<h1 id="Hi_Common_Collections_ListUtil" data-uid="Hi.Common.Collections.ListUtil" class="text-break">
Class ListUtil
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="Hi.html">Hi</a>.<a class="xref" href="Hi.Common.html">Common</a>.<a class="xref" href="Hi.Common.Collections.html">Collections</a></dd></dl>
<dl><dt>Assembly</dt><dd>HiGeom.dll</dd></dl>
</div>
<div class="markdown summary"><p>Provides utility methods for working with lists and collections.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static class ListUtil</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">ListUtil</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="Hi_Common_Collections_ListUtil_GetCeilBySeek_" data-uid="Hi.Common.Collections.ListUtil.GetCeilBySeek*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetCeilBySeek__2_System_Collections_Generic_IList___0____1_System_Func___0___1____0__System_Int32__System_Int32_Hi_Common_Collections_SeekDirection_" data-uid="Hi.Common.Collections.ListUtil.GetCeilBySeek``2(System.Collections.Generic.IList{``0},``1,System.Func{``0,``1},``0@,System.Int32@,System.Int32,Hi.Common.Collections.SeekDirection)">
GetCeilBySeek&lt;TItem, TKey&gt;(IList&lt;TItem&gt;, TKey, Func&lt;TItem, TKey&gt;, out TItem, out int, int, SeekDirection)
</h3>
<div class="markdown level1 summary"><p>Gets the ceil item by seeking with the specified direction.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetCeilBySeek&lt;TItem, TKey&gt;(this IList&lt;TItem&gt; src, TKey key, Func&lt;TItem, TKey&gt; getKeyFunc, out TItem ceilValue, out int ceilIndex, int seekingStartIndex, SeekDirection seekDirection = SeekDirection.Free) where TKey : IComparable&lt;TKey&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>key</code> <span class="xref">TKey</span></dt>
<dd><p>The key to search for.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>ceilValue</code> <span class="xref">TItem</span></dt>
<dd><p>The output ceil value.</p>
</dd>
<dt><code>ceilIndex</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The output ceil index.</p>
</dd>
<dt><code>seekingStartIndex</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The start index for seeking.</p>
</dd>
<dt><code>seekDirection</code> <a class="xref" href="Hi.Common.Collections.SeekDirection.html">SeekDirection</a></dt>
<dd><p>The seek direction.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>The search result.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
<dt><code>TKey</code></dt>
<dd><p>The type of the key.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetCeilIndexBySeek_" data-uid="Hi.Common.Collections.ListUtil.GetCeilIndexBySeek*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetCeilIndexBySeek__2_System_Collections_Generic_IList___0____1_System_Func___0___1__System_Int32__System_Int32_Hi_Common_Collections_SeekDirection_" data-uid="Hi.Common.Collections.ListUtil.GetCeilIndexBySeek``2(System.Collections.Generic.IList{``0},``1,System.Func{``0,``1},System.Int32@,System.Int32,Hi.Common.Collections.SeekDirection)">
GetCeilIndexBySeek&lt;TItem, TKey&gt;(IList&lt;TItem&gt;, TKey, Func&lt;TItem, TKey&gt;, out int, int, SeekDirection)
</h3>
<div class="markdown level1 summary"><p>Gets the ceil index by seeking with the specified direction.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetCeilIndexBySeek&lt;TItem, TKey&gt;(this IList&lt;TItem&gt; src, TKey key, Func&lt;TItem, TKey&gt; getKeyFunc, out int ceilIndex, int seekingStartIndex, SeekDirection seekDirection = SeekDirection.Free) where TKey : IComparable&lt;TKey&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>key</code> <span class="xref">TKey</span></dt>
<dd><p>The key to search for.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>ceilIndex</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The output ceil index.</p>
</dd>
<dt><code>seekingStartIndex</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The start index for seeking.</p>
</dd>
<dt><code>seekDirection</code> <a class="xref" href="Hi.Common.Collections.SeekDirection.html">SeekDirection</a></dt>
<dd><p>The seek direction.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>The search result.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
<dt><code>TKey</code></dt>
<dd><p>The type of the key.</p>
</dd>
</dl>
<h4 class="section" id="Hi_Common_Collections_ListUtil_GetCeilIndexBySeek__2_System_Collections_Generic_IList___0____1_System_Func___0___1__System_Int32__System_Int32_Hi_Common_Collections_SeekDirection__remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>The <a class="xref" href="Hi.Common.Collections.SeekDirection.html#Hi_Common_Collections_SeekDirection_Free">Free</a> seek direction does not loss additional performance.
The seek direction only effect the resulting value by the <code class="paramref">seekingStartIndex</code> bound.</p>
</div>
<a id="Hi_Common_Collections_ListUtil_GetCeilIndex_" data-uid="Hi.Common.Collections.ListUtil.GetCeilIndex*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetCeilIndex__2_System_Collections_Generic_IList___0____1_System_Func___0___1_System_Int32__System_Int32__" data-uid="Hi.Common.Collections.ListUtil.GetCeilIndex``2(System.Collections.Generic.IList{``0},``1,System.Func{``0,``1,System.Int32},System.Int32@)">
GetCeilIndex&lt;Item, ItemKey&gt;(IList&lt;Item&gt;, ItemKey, Func&lt;Item, ItemKey, int&gt;, out int)
</h3>
<div class="markdown level1 summary"><p>Gets the ceiling index of an item in a sorted list based on a key comparison.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetCeilIndex&lt;Item, ItemKey&gt;(this IList&lt;Item&gt; sortedItems, ItemKey key, Func&lt;Item, ItemKey, int&gt; comparingFunc, out int index)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;Item&gt;</dt>
<dd><p>The sorted list to search in.</p>
</dd>
<dt><code>key</code> <span class="xref">ItemKey</span></dt>
<dd><p>The key to search for.</p>
</dd>
<dt><code>comparingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;Item, ItemKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</dt>
<dd><p>A function that compares an item to the key.</p>
</dd>
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>When this method returns, contains the index of the ceiling item if found; otherwise, -1.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>A <a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a> indicating the result of the search.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>Item</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
<dt><code>ItemKey</code></dt>
<dd><p>The type of the key to search for.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetCeilIndex_" data-uid="Hi.Common.Collections.ListUtil.GetCeilIndex*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetCeilIndex__2_System_Collections_Generic_IList___1____0_System_Func___1___0__System_Int32__" data-uid="Hi.Common.Collections.ListUtil.GetCeilIndex``2(System.Collections.Generic.IList{``1},``0,System.Func{``1,``0},System.Int32@)">
GetCeilIndex&lt;TKey, Item&gt;(IList&lt;Item&gt;, TKey, Func&lt;Item, TKey&gt;, out int)
</h3>
<div class="markdown level1 summary"><p>Gets the ceiling index of an item in a sorted list based on a key selector function.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetCeilIndex&lt;TKey, Item&gt;(this IList&lt;Item&gt; sortedItems, TKey keyQuantity, Func&lt;Item, TKey&gt; getKeyQuantityFunc, out int index) where TKey : IComparable&lt;TKey&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;Item&gt;</dt>
<dd><p>The sorted list to search in.</p>
</dd>
<dt><code>keyQuantity</code> <span class="xref">TKey</span></dt>
<dd><p>The key to search for.</p>
</dd>
<dt><code>getKeyQuantityFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;Item, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>When this method returns, contains the index of the ceiling item if found; otherwise, -1.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>A <a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a> indicating the result of the search.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TKey</code></dt>
<dd><p>The type of the key.</p>
</dd>
<dt><code>Item</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetCeil_" data-uid="Hi.Common.Collections.ListUtil.GetCeil*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetCeil__2_System_Collections_Generic_IList___1____0_System_Func___1___0____1__" data-uid="Hi.Common.Collections.ListUtil.GetCeil``2(System.Collections.Generic.IList{``1},``0,System.Func{``1,``0},``1@)">
GetCeil&lt;TKey, Item&gt;(IList&lt;Item&gt;, TKey, Func&lt;Item, TKey&gt;, out Item)
</h3>
<div class="markdown level1 summary"><p>Gets the ceiling item in a sorted list based on a key selector function.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetCeil&lt;TKey, Item&gt;(this IList&lt;Item&gt; sortedItems, TKey keyQuantity, Func&lt;Item, TKey&gt; getKeyQuantityFunc, out Item dst) where TKey : IComparable&lt;TKey&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;Item&gt;</dt>
<dd><p>The sorted list to search in.</p>
</dd>
<dt><code>keyQuantity</code> <span class="xref">TKey</span></dt>
<dd><p>The key to search for.</p>
</dd>
<dt><code>getKeyQuantityFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;Item, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>dst</code> <span class="xref">Item</span></dt>
<dd><p>When this method returns, contains the ceiling item if found; otherwise, the default value for the type.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>A <a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a> indicating the result of the search.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TKey</code></dt>
<dd><p>The type of the key.</p>
</dd>
<dt><code>Item</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetFloorBySeek_" data-uid="Hi.Common.Collections.ListUtil.GetFloorBySeek*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetFloorBySeek__2_System_Collections_Generic_IList___0____1_System_Func___0___1____0__System_Int32__System_Int32_Hi_Common_Collections_SeekDirection_" data-uid="Hi.Common.Collections.ListUtil.GetFloorBySeek``2(System.Collections.Generic.IList{``0},``1,System.Func{``0,``1},``0@,System.Int32@,System.Int32,Hi.Common.Collections.SeekDirection)">
GetFloorBySeek&lt;TItem, TKey&gt;(IList&lt;TItem&gt;, TKey, Func&lt;TItem, TKey&gt;, out TItem, out int, int, SeekDirection)
</h3>
<div class="markdown level1 summary"><p>Gets the floor item by seeking with the specified direction.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetFloorBySeek&lt;TItem, TKey&gt;(this IList&lt;TItem&gt; src, TKey key, Func&lt;TItem, TKey&gt; getKeyFunc, out TItem floorValue, out int floorIndex, int seekingStartIndex, SeekDirection seekDirection = SeekDirection.Free) where TKey : IComparable&lt;TKey&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>key</code> <span class="xref">TKey</span></dt>
<dd><p>The key to search for.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>floorValue</code> <span class="xref">TItem</span></dt>
<dd><p>The output floor value.</p>
</dd>
<dt><code>floorIndex</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The output floor index.</p>
</dd>
<dt><code>seekingStartIndex</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The start index for seeking.</p>
</dd>
<dt><code>seekDirection</code> <a class="xref" href="Hi.Common.Collections.SeekDirection.html">SeekDirection</a></dt>
<dd><p>The seek direction.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>The search result.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
<dt><code>TKey</code></dt>
<dd><p>The type of the key.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetFloorIndexBySeek_" data-uid="Hi.Common.Collections.ListUtil.GetFloorIndexBySeek*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetFloorIndexBySeek__2_System_Collections_Generic_IList___0____1_System_Func___0___1__System_Int32__System_Int32_Hi_Common_Collections_SeekDirection_" data-uid="Hi.Common.Collections.ListUtil.GetFloorIndexBySeek``2(System.Collections.Generic.IList{``0},``1,System.Func{``0,``1},System.Int32@,System.Int32,Hi.Common.Collections.SeekDirection)">
GetFloorIndexBySeek&lt;TItem, TKey&gt;(IList&lt;TItem&gt;, TKey, Func&lt;TItem, TKey&gt;, out int, int, SeekDirection)
</h3>
<div class="markdown level1 summary"><p>Gets the floor index by seeking with the specified direction.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetFloorIndexBySeek&lt;TItem, TKey&gt;(this IList&lt;TItem&gt; src, TKey key, Func&lt;TItem, TKey&gt; getKeyFunc, out int floorIndex, int seekingStartIndex, SeekDirection seekDirection = SeekDirection.Free) where TKey : IComparable&lt;TKey&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>key</code> <span class="xref">TKey</span></dt>
<dd><p>The key to search for.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>floorIndex</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The output floor index.</p>
</dd>
<dt><code>seekingStartIndex</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The start index for seeking.</p>
</dd>
<dt><code>seekDirection</code> <a class="xref" href="Hi.Common.Collections.SeekDirection.html">SeekDirection</a></dt>
<dd><p>The seek direction.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>The search result.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
<dt><code>TKey</code></dt>
<dd><p>The type of the key.</p>
</dd>
</dl>
<h4 class="section" id="Hi_Common_Collections_ListUtil_GetFloorIndexBySeek__2_System_Collections_Generic_IList___0____1_System_Func___0___1__System_Int32__System_Int32_Hi_Common_Collections_SeekDirection__remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>The <a class="xref" href="Hi.Common.Collections.SeekDirection.html#Hi_Common_Collections_SeekDirection_Free">Free</a> seek direction does not loss additional performance.
The seek direction only effect the resulting value by the <code class="paramref">seekingStartIndex</code> bound.</p>
</div>
<a id="Hi_Common_Collections_ListUtil_GetFloorIndex_" data-uid="Hi.Common.Collections.ListUtil.GetFloorIndex*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetFloorIndex__2_System_Collections_Generic_IList___0____1_System_Func___0___1_System_Int32__System_Int32__" data-uid="Hi.Common.Collections.ListUtil.GetFloorIndex``2(System.Collections.Generic.IList{``0},``1,System.Func{``0,``1,System.Int32},System.Int32@)">
GetFloorIndex&lt;Item, ItemKey&gt;(IList&lt;Item&gt;, ItemKey, Func&lt;Item, ItemKey, int&gt;, out int)
</h3>
<div class="markdown level1 summary"><p>Gets the floor index of an item in a sorted list based on a key comparison.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetFloorIndex&lt;Item, ItemKey&gt;(this IList&lt;Item&gt; sortedItems, ItemKey key, Func&lt;Item, ItemKey, int&gt; comparingFunc, out int index)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;Item&gt;</dt>
<dd><p>The sorted list to search in.</p>
</dd>
<dt><code>key</code> <span class="xref">ItemKey</span></dt>
<dd><p>The key to search for.</p>
</dd>
<dt><code>comparingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;Item, ItemKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</dt>
<dd><p>A function that compares an item to the key.</p>
</dd>
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>When this method returns, contains the index of the floor item if found; otherwise, -1.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>A <a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a> indicating the result of the search.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>Item</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
<dt><code>ItemKey</code></dt>
<dd><p>The type of the key to search for.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetFloorIndex_" data-uid="Hi.Common.Collections.ListUtil.GetFloorIndex*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetFloorIndex__2_System_Collections_Generic_IList___1____0_System_Func___1___0__System_Int32__" data-uid="Hi.Common.Collections.ListUtil.GetFloorIndex``2(System.Collections.Generic.IList{``1},``0,System.Func{``1,``0},System.Int32@)">
GetFloorIndex&lt;TKey, Item&gt;(IList&lt;Item&gt;, TKey, Func&lt;Item, TKey&gt;, out int)
</h3>
<div class="markdown level1 summary"><p>Gets the floor index of an item in a sorted list based on a key selector function.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetFloorIndex&lt;TKey, Item&gt;(this IList&lt;Item&gt; sortedItems, TKey key, Func&lt;Item, TKey&gt; getKeyFunc, out int index) where TKey : IComparable&lt;TKey&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;Item&gt;</dt>
<dd><p>The sorted list to search in.</p>
</dd>
<dt><code>key</code> <span class="xref">TKey</span></dt>
<dd><p>The key to search for.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;Item, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>When this method returns, contains the index of the floor item if found; otherwise, -1.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>A <a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a> indicating the result of the search.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TKey</code></dt>
<dd><p>The type of the key.</p>
</dd>
<dt><code>Item</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetFloor_" data-uid="Hi.Common.Collections.ListUtil.GetFloor*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetFloor__2_System_Collections_Generic_IList___1____0_System_Func___1___0____1__" data-uid="Hi.Common.Collections.ListUtil.GetFloor``2(System.Collections.Generic.IList{``1},``0,System.Func{``1,``0},``1@)">
GetFloor&lt;TKey, Item&gt;(IList&lt;Item&gt;, TKey, Func&lt;Item, TKey&gt;, out Item)
</h3>
<div class="markdown level1 summary"><p>Gets the floor item in a sorted list based on a key selector function.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetFloor&lt;TKey, Item&gt;(this IList&lt;Item&gt; sortedItems, TKey keyQuantity, Func&lt;Item, TKey&gt; getKeyQuantityFunc, out Item dst) where TKey : IComparable&lt;TKey&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;Item&gt;</dt>
<dd><p>The sorted list to search in.</p>
</dd>
<dt><code>keyQuantity</code> <span class="xref">TKey</span></dt>
<dd><p>The key to search for.</p>
</dd>
<dt><code>getKeyQuantityFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;Item, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>dst</code> <span class="xref">Item</span></dt>
<dd><p>When this method returns, contains the floor item if found; otherwise, the default value for the type.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>A <a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a> indicating the result of the search.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TKey</code></dt>
<dd><p>The type of the key.</p>
</dd>
<dt><code>Item</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetIndexBasedEnumerable_" data-uid="Hi.Common.Collections.ListUtil.GetIndexBasedEnumerable*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetIndexBasedEnumerable__1_System_Collections_Generic_IList___0__" data-uid="Hi.Common.Collections.ListUtil.GetIndexBasedEnumerable``1(System.Collections.Generic.IList{``0})">
GetIndexBasedEnumerable&lt;TItem&gt;(IList&lt;TItem&gt;)
</h3>
<div class="markdown level1 summary"><p>Creates an enumerable that provides access to all elements in a list by index.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static ListIndexBasedEnumerable&lt;TItem&gt; GetIndexBasedEnumerable&lt;TItem&gt;(this IList&lt;TItem&gt; src)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The source list</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.Collections.ListIndexBasedEnumerable-1.html">ListIndexBasedEnumerable</a>&lt;TItem&gt;</dt>
<dd><p>A ListIndexBasedEnumerable for the entire list</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of elements in the list</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetIndexBasedEnumerable_" data-uid="Hi.Common.Collections.ListUtil.GetIndexBasedEnumerable*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetIndexBasedEnumerable__1_System_Collections_Generic_IList___0__System_Int32_System_Int32_" data-uid="Hi.Common.Collections.ListUtil.GetIndexBasedEnumerable``1(System.Collections.Generic.IList{``0},System.Int32,System.Int32)">
GetIndexBasedEnumerable&lt;TItem&gt;(IList&lt;TItem&gt;, int, int)
</h3>
<div class="markdown level1 summary"><p>Creates an enumerable that provides access to a range of elements in a list by index.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static ListIndexBasedEnumerable&lt;TItem&gt; GetIndexBasedEnumerable&lt;TItem&gt;(this IList&lt;TItem&gt; src, int begin, int end)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The source list</p>
</dd>
<dt><code>begin</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The starting index (inclusive)</p>
</dd>
<dt><code>end</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The ending index (exclusive)</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.Collections.ListIndexBasedEnumerable-1.html">ListIndexBasedEnumerable</a>&lt;TItem&gt;</dt>
<dd><p>A ListIndexBasedEnumerable for the specified range</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of elements in the list</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetIndexByBinarySearch_" data-uid="Hi.Common.Collections.ListUtil.GetIndexByBinarySearch*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetIndexByBinarySearch__1_System_Collections_Generic_IList___0____0_" data-uid="Hi.Common.Collections.ListUtil.GetIndexByBinarySearch``1(System.Collections.Generic.IList{``0},``0)">
GetIndexByBinarySearch&lt;TItem&gt;(IList&lt;TItem&gt;, TItem)
</h3>
<div class="markdown level1 summary"><p>Performs a binary search on the specified collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int GetIndexByBinarySearch&lt;TItem&gt;(this IList&lt;TItem&gt; sortedItems, TItem value)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The list to be searched.</p>
</dd>
<dt><code>value</code> <span class="xref">TItem</span></dt>
<dd><p>The value to search for.</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></dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of the item.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetIndexByBinarySearch_" data-uid="Hi.Common.Collections.ListUtil.GetIndexByBinarySearch*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetIndexByBinarySearch__1_System_Collections_Generic_IList___0____0_System_Collections_Generic_IComparer___0__" data-uid="Hi.Common.Collections.ListUtil.GetIndexByBinarySearch``1(System.Collections.Generic.IList{``0},``0,System.Collections.Generic.IComparer{``0})">
GetIndexByBinarySearch&lt;TItem&gt;(IList&lt;TItem&gt;, TItem, IComparer&lt;TItem&gt;)
</h3>
<div class="markdown level1 summary"><p>Performs a binary search on the specified collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int GetIndexByBinarySearch&lt;TItem&gt;(this IList&lt;TItem&gt; sortedItems, TItem value, IComparer&lt;TItem&gt; comparer)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The list to be searched.</p>
</dd>
<dt><code>value</code> <span class="xref">TItem</span></dt>
<dd><p>The value to search for.</p>
</dd>
<dt><code>comparer</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.icomparer-1">IComparer</a>&lt;TItem&gt;</dt>
<dd><p>The comparer that is used to compare the value
with the list items.</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></dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of the item.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetIndexByBinarySearch_" data-uid="Hi.Common.Collections.ListUtil.GetIndexByBinarySearch*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetIndexByBinarySearch__2_System_Collections_Generic_IList___0____1_System_Func___1___0_System_Int32__" data-uid="Hi.Common.Collections.ListUtil.GetIndexByBinarySearch``2(System.Collections.Generic.IList{``0},``1,System.Func{``1,``0,System.Int32})">
GetIndexByBinarySearch&lt;TItem, TSearch&gt;(IList&lt;TItem&gt;, TSearch, Func&lt;TSearch, TItem, int&gt;)
</h3>
<div class="markdown level1 summary"><p>Performs a binary search on the specified collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int GetIndexByBinarySearch&lt;TItem, TSearch&gt;(this IList&lt;TItem&gt; sortedItems, TSearch value, Func&lt;TSearch, TItem, int&gt; comparer)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The list to be searched.</p>
</dd>
<dt><code>value</code> <span class="xref">TSearch</span></dt>
<dd><p>The value to search for.</p>
</dd>
<dt><code>comparer</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TSearch, TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</dt>
<dd><p>The comparer that is used to compare the value
with the list items.</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></dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of the item.</p>
</dd>
<dt><code>TSearch</code></dt>
<dd><p>The type of the searched item.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetInterpolatedBoundary_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedBoundary*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetInterpolatedBoundary__1_System_Collections_Generic_List___0__System_Double_System_Double_System_Func___0_System_Double____0____0____0__" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedBoundary``1(System.Collections.Generic.List{``0},System.Double,System.Double,System.Func{``0,System.Double},``0@,``0@,``0@)">
GetInterpolatedBoundary&lt;TItem&gt;(List&lt;TItem&gt;, double, double, Func&lt;TItem, double&gt;, out TItem, out TItem, out TItem)
</h3>
<div class="markdown level1 summary"><p>Gets interpolated boundary items from a list based on a key value and interval.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void GetInterpolatedBoundary&lt;TItem&gt;(this List&lt;TItem&gt; scpList, double z, double zInterval, Func&lt;TItem, double&gt; keyFunc, out TItem cur, out TItem floor, out TItem ceil) where TItem : IAdditionOperators&lt;TItem, TItem, TItem&gt;, IMultiplyOperators&lt;TItem, double, TItem&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>scpList</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>z</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>The key value to find or interpolate at.</p>
</dd>
<dt><code>zInterval</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>The interval to consider around the key value.</p>
</dd>
<dt><code>keyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>cur</code> <span class="xref">TItem</span></dt>
<dd><p>When this method returns, contains the interpolated item at the key value.</p>
</dd>
<dt><code>floor</code> <span class="xref">TItem</span></dt>
<dd><p>When this method returns, contains the floor item.</p>
</dd>
<dt><code>ceil</code> <span class="xref">TItem</span></dt>
<dd><p>When this method returns, contains the ceiling item.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list, which must support addition and multiplication operators.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetInterpolatedValue_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedValue*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetInterpolatedValue__1_System_Collections_Generic_List___0__System_Double_System_Func___0_System_Double__Hi_Common_Collections_ListUtil_OuterPolationMode_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedValue``1(System.Collections.Generic.List{``0},System.Double,System.Func{``0,System.Double},Hi.Common.Collections.ListUtil.OuterPolationMode)">
GetInterpolatedValue&lt;TItem&gt;(List&lt;TItem&gt;, double, Func&lt;TItem, double&gt;, OuterPolationMode)
</h3>
<div class="markdown level1 summary"><p>Gets an interpolated value from a sorted list based on a double key, using operators for addition and multiplication.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static TItem GetInterpolatedValue&lt;TItem&gt;(this List&lt;TItem&gt; sortedItems, double keyQuantity, Func&lt;TItem, double&gt; getKeyQuantityFunc, ListUtil.OuterPolationMode outerPolationMode) where TItem : IAdditionOperators&lt;TItem, TItem, TItem&gt;, IMultiplyOperators&lt;TItem, double, TItem&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The sorted list to interpolate from.</p>
</dd>
<dt><code>keyQuantity</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>The key to find or interpolate at.</p>
</dd>
<dt><code>getKeyQuantityFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>outerPolationMode</code> <a class="xref" href="Hi.Common.Collections.ListUtil.html">ListUtil</a>.<a class="xref" href="Hi.Common.Collections.ListUtil.OuterPolationMode.html">OuterPolationMode</a></dt>
<dd><p>The mode to use when the key is outside the range of the list.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><span class="xref">TItem</span></dt>
<dd><p>The interpolated value.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list, which must support addition and multiplication operators.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetInterpolatedValue_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedValue*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetInterpolatedValue__1_System_Collections_Generic_List___0__System_Double_System_Func___0_System_Double__System_Func___0___0___0__System_Func___0_System_Double___0__Hi_Common_Collections_ListUtil_OuterPolationMode_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedValue``1(System.Collections.Generic.List{``0},System.Double,System.Func{``0,System.Double},System.Func{``0,``0,``0},System.Func{``0,System.Double,``0},Hi.Common.Collections.ListUtil.OuterPolationMode)">
GetInterpolatedValue&lt;TItem&gt;(List&lt;TItem&gt;, double, Func&lt;TItem, double&gt;, Func&lt;TItem, TItem, TItem&gt;, Func&lt;TItem, double, TItem&gt;, OuterPolationMode)
</h3>
<div class="markdown level1 summary"><p>Gets an interpolated value from a sorted list based on a double key.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static TItem GetInterpolatedValue&lt;TItem&gt;(this List&lt;TItem&gt; sortedItems, double key, Func&lt;TItem, double&gt; getKeyFunc, Func&lt;TItem, TItem, TItem&gt; itemAddingFunc, Func&lt;TItem, double, TItem&gt; itemScalingFunc, ListUtil.OuterPolationMode outerPolationMode)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The sorted list to interpolate from.</p>
</dd>
<dt><code>key</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>The key to find or interpolate at.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>itemAddingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItem, TItem&gt;</dt>
<dd><p>A function that adds two items together.</p>
</dd>
<dt><code>itemScalingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, TItem&gt;</dt>
<dd><p>A function that scales an item by a factor.</p>
</dd>
<dt><code>outerPolationMode</code> <a class="xref" href="Hi.Common.Collections.ListUtil.html">ListUtil</a>.<a class="xref" href="Hi.Common.Collections.ListUtil.OuterPolationMode.html">OuterPolationMode</a></dt>
<dd><p>The mode to use when the key is outside the range of the list.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><span class="xref">TItem</span></dt>
<dd><p>The interpolated value.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetInterpolatedValue_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedValue*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetInterpolatedValue__1_System_Collections_Generic_List___0__System_TimeSpan_System_Func___0_System_TimeSpan__Hi_Common_Collections_ListUtil_OuterPolationMode_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedValue``1(System.Collections.Generic.List{``0},System.TimeSpan,System.Func{``0,System.TimeSpan},Hi.Common.Collections.ListUtil.OuterPolationMode)">
GetInterpolatedValue&lt;TItem&gt;(List&lt;TItem&gt;, TimeSpan, Func&lt;TItem, TimeSpan&gt;, OuterPolationMode)
</h3>
<div class="markdown level1 summary"><p>Gets an interpolated value from a sorted list based on a TimeSpan key, using operators for addition and multiplication.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static TItem GetInterpolatedValue&lt;TItem&gt;(this List&lt;TItem&gt; sortedItems, TimeSpan keyQuantity, Func&lt;TItem, TimeSpan&gt; getKeyQuantityFunc, ListUtil.OuterPolationMode outerPolationMode) where TItem : IAdditionOperators&lt;TItem, TItem, TItem&gt;, IMultiplyOperators&lt;TItem, double, TItem&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The sorted list to interpolate from.</p>
</dd>
<dt><code>keyQuantity</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a></dt>
<dd><p>The TimeSpan key to find or interpolate at.</p>
</dd>
<dt><code>getKeyQuantityFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a>&gt;</dt>
<dd><p>A function that extracts the TimeSpan key from an item.</p>
</dd>
<dt><code>outerPolationMode</code> <a class="xref" href="Hi.Common.Collections.ListUtil.html">ListUtil</a>.<a class="xref" href="Hi.Common.Collections.ListUtil.OuterPolationMode.html">OuterPolationMode</a></dt>
<dd><p>The mode to use when the key is outside the range of the list.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><span class="xref">TItem</span></dt>
<dd><p>The interpolated value.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list, which must support addition and multiplication operators.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetInterpolatedValue_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedValue*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetInterpolatedValue__1_System_Collections_Generic_List___0__System_TimeSpan_System_Func___0_System_TimeSpan__System_Func___0___0___0__System_Func___0_System_Double___0__Hi_Common_Collections_ListUtil_OuterPolationMode_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedValue``1(System.Collections.Generic.List{``0},System.TimeSpan,System.Func{``0,System.TimeSpan},System.Func{``0,``0,``0},System.Func{``0,System.Double,``0},Hi.Common.Collections.ListUtil.OuterPolationMode)">
GetInterpolatedValue&lt;TItem&gt;(List&lt;TItem&gt;, TimeSpan, Func&lt;TItem, TimeSpan&gt;, Func&lt;TItem, TItem, TItem&gt;, Func&lt;TItem, double, TItem&gt;, OuterPolationMode)
</h3>
<div class="markdown level1 summary"><p>Gets an interpolated value from a sorted list based on a TimeSpan key.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static TItem GetInterpolatedValue&lt;TItem&gt;(this List&lt;TItem&gt; sortedItems, TimeSpan key, Func&lt;TItem, TimeSpan&gt; getKeyFunc, Func&lt;TItem, TItem, TItem&gt; itemAddingFunc, Func&lt;TItem, double, TItem&gt; itemScalingFunc, ListUtil.OuterPolationMode outerPolationMode)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The sorted list to interpolate from.</p>
</dd>
<dt><code>key</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a></dt>
<dd><p>The TimeSpan key to find or interpolate at.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a>&gt;</dt>
<dd><p>A function that extracts the TimeSpan key from an item.</p>
</dd>
<dt><code>itemAddingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItem, TItem&gt;</dt>
<dd><p>A function that adds two items together.</p>
</dd>
<dt><code>itemScalingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, TItem&gt;</dt>
<dd><p>A function that scales an item by a factor.</p>
</dd>
<dt><code>outerPolationMode</code> <a class="xref" href="Hi.Common.Collections.ListUtil.html">ListUtil</a>.<a class="xref" href="Hi.Common.Collections.ListUtil.OuterPolationMode.html">OuterPolationMode</a></dt>
<dd><p>The mode to use when the key is outside the range of the list.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><span class="xref">TItem</span></dt>
<dd><p>The interpolated value.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetInterpolatedValue_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedValue*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetInterpolatedValue__2_System_Collections_Generic_List___1____0_System_Func___1___0__System_Func___0___0_System_Int32__System_Func___0___0___0__System_Func___0___0_System_Double__System_Func___1___1___1__System_Func___1_System_Double___1__Hi_Common_Collections_ListUtil_OuterPolationMode_" data-uid="Hi.Common.Collections.ListUtil.GetInterpolatedValue``2(System.Collections.Generic.List{``1},``0,System.Func{``1,``0},System.Func{``0,``0,System.Int32},System.Func{``0,``0,``0},System.Func{``0,``0,System.Double},System.Func{``1,``1,``1},System.Func{``1,System.Double,``1},Hi.Common.Collections.ListUtil.OuterPolationMode)">
GetInterpolatedValue&lt;TKey, TItem&gt;(List&lt;TItem&gt;, TKey, Func&lt;TItem, TKey&gt;, Func&lt;TKey, TKey, int&gt;, Func&lt;TKey, TKey, TKey&gt;, Func&lt;TKey, TKey, double&gt;, Func&lt;TItem, TItem, TItem&gt;, Func&lt;TItem, double, TItem&gt;, OuterPolationMode)
</h3>
<div class="markdown level1 summary"><p>Gets an interpolated value from a sorted list based on a key using custom comparison and arithmetic functions.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static TItem GetInterpolatedValue&lt;TKey, TItem&gt;(this List&lt;TItem&gt; sortedItems, TKey key, Func&lt;TItem, TKey&gt; getKeyFunc, Func&lt;TKey, TKey, int&gt; keyCompareFunc, Func&lt;TKey, TKey, TKey&gt; keyMinusFunc, Func&lt;TKey, TKey, double&gt; keyDivFunc, Func&lt;TItem, TItem, TItem&gt; addingFunc, Func&lt;TItem, double, TItem&gt; scalingFunc, ListUtil.OuterPolationMode outerPolationMode)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The sorted list of items</p>
</dd>
<dt><code>key</code> <span class="xref">TKey</span></dt>
<dd><p>The key to search for</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item</p>
</dd>
<dt><code>keyCompareFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TKey, TKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</dt>
<dd><p>A function that compares two keys</p>
</dd>
<dt><code>keyMinusFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TKey, TKey, TKey&gt;</dt>
<dd><p>A function that subtracts one key from another</p>
</dd>
<dt><code>keyDivFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TKey, TKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>A function that divides one key by another</p>
</dd>
<dt><code>addingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItem, TItem&gt;</dt>
<dd><p>A function that adds two items</p>
</dd>
<dt><code>scalingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, TItem&gt;</dt>
<dd><p>A function that scales an item by a factor</p>
</dd>
<dt><code>outerPolationMode</code> <a class="xref" href="Hi.Common.Collections.ListUtil.html">ListUtil</a>.<a class="xref" href="Hi.Common.Collections.ListUtil.OuterPolationMode.html">OuterPolationMode</a></dt>
<dd><p>The mode for handling values outside the range</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><span class="xref">TItem</span></dt>
<dd><p>The interpolated value</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TKey</code></dt>
<dd><p>The type of the key</p>
</dd>
<dt><code>TItem</code></dt>
<dd><p>The type of elements in the list</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetListByKeyBoundary_" data-uid="Hi.Common.Collections.ListUtil.GetListByKeyBoundary*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetListByKeyBoundary__2_System_Collections_Generic_List___1__System_Func___1___0____0_System_Boolean___0_System_Boolean_" data-uid="Hi.Common.Collections.ListUtil.GetListByKeyBoundary``2(System.Collections.Generic.List{``1},System.Func{``1,``0},``0,System.Boolean,``0,System.Boolean)">
GetListByKeyBoundary&lt;TKey, TItem&gt;(List&lt;TItem&gt;, Func&lt;TItem, TKey&gt;, TKey, bool, TKey, bool)
</h3>
<div class="markdown level1 summary"><p>Gets a subset of a sorted list based on key boundaries.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static List&lt;TItem&gt; GetListByKeyBoundary&lt;TKey, TItem&gt;(this List&lt;TItem&gt; sortedItems, Func&lt;TItem, TKey&gt; getKeyQuantityFunc, TKey begin, bool isIncludingBeginFloor, TKey end, bool isIncludingEndCeil) where TKey : IComparable&lt;TKey&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>sortedItems</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The sorted list to filter.</p>
</dd>
<dt><code>getKeyQuantityFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>begin</code> <span class="xref">TKey</span></dt>
<dd><p>The beginning key of the range.</p>
</dd>
<dt><code>isIncludingBeginFloor</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
<dd><p>Whether to include the floor of the beginning key.</p>
</dd>
<dt><code>end</code> <span class="xref">TKey</span></dt>
<dd><p>The ending key of the range.</p>
</dd>
<dt><code>isIncludingEndCeil</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
<dd><p>Whether to include the ceiling of the ending key.</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.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>A new list containing only the items within the specified key range.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TKey</code></dt>
<dd><p>The type of the key, which must be comparable.</p>
</dd>
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetNearestIndex_" data-uid="Hi.Common.Collections.ListUtil.GetNearestIndex*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetNearestIndex__2_System_Collections_Generic_IList___0____1_System_Func___0___1_System_Double__System_Int32__" data-uid="Hi.Common.Collections.ListUtil.GetNearestIndex``2(System.Collections.Generic.IList{``0},``1,System.Func{``0,``1,System.Double},System.Int32@)">
GetNearestIndex&lt;TItem, TItemKey&gt;(IList&lt;TItem&gt;, TItemKey, Func&lt;TItem, TItemKey, double&gt;, out int)
</h3>
<div class="markdown level1 summary"><p>Finds the index of the element in a sorted list that is nearest to the specified key.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetNearestIndex&lt;TItem, TItemKey&gt;(this IList&lt;TItem&gt; src, TItemKey key, Func&lt;TItem, TItemKey, double&gt; itemToKeyDistanceFunc, out int index)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The source list</p>
</dd>
<dt><code>key</code> <span class="xref">TItemKey</span></dt>
<dd><p>The key to search for</p>
</dd>
<dt><code>itemToKeyDistanceFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItemKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>A function that calculates the distance between an item and the key</p>
</dd>
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>When this method returns, contains the index of the nearest element if found; otherwise, -1</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>A BinarySearchResult indicating the result of the search</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of elements in the list</p>
</dd>
<dt><code>TItemKey</code></dt>
<dd><p>The type of the key to search for</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetNearestIndex_" data-uid="Hi.Common.Collections.ListUtil.GetNearestIndex*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetNearestIndex__2_System_Collections_Generic_IList___0____1_System_Func___0___1_System_Int32__System_Func___0___1_System_Double__System_Int32__" data-uid="Hi.Common.Collections.ListUtil.GetNearestIndex``2(System.Collections.Generic.IList{``0},``1,System.Func{``0,``1,System.Int32},System.Func{``0,``1,System.Double},System.Int32@)">
GetNearestIndex&lt;TItem, TItemKey&gt;(IList&lt;TItem&gt;, TItemKey, Func&lt;TItem, TItemKey, int&gt;, Func&lt;TItem, TItemKey, double&gt;, out int)
</h3>
<div class="markdown level1 summary"><p>Finds the index of the element in a sorted list that is nearest to the specified key using custom comparison functions.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SearchResult GetNearestIndex&lt;TItem, TItemKey&gt;(this IList&lt;TItem&gt; src, TItemKey key, Func&lt;TItem, TItemKey, int&gt; itemCompareToKeyFunc, Func&lt;TItem, TItemKey, double&gt; itemToKeyDistanceFunc, out int index)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The source list (must be in ascending order)</p>
</dd>
<dt><code>key</code> <span class="xref">TItemKey</span></dt>
<dd><p>The key to search for</p>
</dd>
<dt><code>itemCompareToKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItemKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</dt>
<dd><p>A function that compares an item to the key</p>
</dd>
<dt><code>itemToKeyDistanceFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItemKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>A function that calculates the distance between an item and the key</p>
</dd>
<dt><code>index</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>When this method returns, contains the index of the nearest element if found; otherwise, -1</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.SearchResult.html">SearchResult</a></dt>
<dd><p>A BinarySearchResult indicating the result of the search</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of elements in the list</p>
</dd>
<dt><code>TItemKey</code></dt>
<dd><p>The type of the key to search for</p>
</dd>
</dl>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.invalidprogramexception">InvalidProgramException</a></dt>
<dd><p>Thrown when an unexpected search result occurs</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedHeadAndTail_" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedHeadAndTail*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedHeadAndTail__1_System_Collections_Generic_List___0__System_Double_System_Double_System_Func___0_System_Double__System_Func___0___0___0__System_Func___0_System_Double___0__" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedHeadAndTail``1(System.Collections.Generic.List{``0},System.Double,System.Double,System.Func{``0,System.Double},System.Func{``0,``0,``0},System.Func{``0,System.Double,``0})">
GetSubListWithInterpolatedHeadAndTail&lt;TItem&gt;(List&lt;TItem&gt;, double, double, Func&lt;TItem, double&gt;, Func&lt;TItem, TItem, TItem&gt;, Func&lt;TItem, double, TItem&gt;)
</h3>
<div class="markdown level1 summary"><p>Creates a new list with interpolated head and tail items based on the specified double key range.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static List&lt;TItem&gt; GetSubListWithInterpolatedHeadAndTail&lt;TItem&gt;(this List&lt;TItem&gt; src, double beginKey, double endKey, Func&lt;TItem, double&gt; getKeyFunc, Func&lt;TItem, TItem, TItem&gt; itemAddingFunc, Func&lt;TItem, double, TItem&gt; itemScalingFunc)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>beginKey</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>The beginning key of the range.</p>
</dd>
<dt><code>endKey</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>The ending key of the range.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>A function that extracts the double key from an item.</p>
</dd>
<dt><code>itemAddingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItem, TItem&gt;</dt>
<dd><p>A function that adds two items together.</p>
</dd>
<dt><code>itemScalingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, TItem&gt;</dt>
<dd><p>A function that scales an item by a factor.</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.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>A new list with interpolated head and tail items.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedHeadAndTail_" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedHeadAndTail*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedHeadAndTail__1_System_Collections_Generic_List___0__System_TimeSpan_System_TimeSpan_System_Func___0_System_TimeSpan__System_Func___0___0___0__System_Func___0_System_Double___0__" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedHeadAndTail``1(System.Collections.Generic.List{``0},System.TimeSpan,System.TimeSpan,System.Func{``0,System.TimeSpan},System.Func{``0,``0,``0},System.Func{``0,System.Double,``0})">
GetSubListWithInterpolatedHeadAndTail&lt;TItem&gt;(List&lt;TItem&gt;, TimeSpan, TimeSpan, Func&lt;TItem, TimeSpan&gt;, Func&lt;TItem, TItem, TItem&gt;, Func&lt;TItem, double, TItem&gt;)
</h3>
<div class="markdown level1 summary"><p>Creates a new list with interpolated head and tail items based on the specified TimeSpan key range.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static List&lt;TItem&gt; GetSubListWithInterpolatedHeadAndTail&lt;TItem&gt;(this List&lt;TItem&gt; src, TimeSpan beginKey, TimeSpan endKey, Func&lt;TItem, TimeSpan&gt; getKeyFunc, Func&lt;TItem, TItem, TItem&gt; itemAddingFunc, Func&lt;TItem, double, TItem&gt; itemScalingFunc)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>beginKey</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a></dt>
<dd><p>The beginning TimeSpan key of the range.</p>
</dd>
<dt><code>endKey</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a></dt>
<dd><p>The ending TimeSpan key of the range.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a>&gt;</dt>
<dd><p>A function that extracts the TimeSpan key from an item.</p>
</dd>
<dt><code>itemAddingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItem, TItem&gt;</dt>
<dd><p>A function that adds two items together.</p>
</dd>
<dt><code>itemScalingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, TItem&gt;</dt>
<dd><p>A function that scales an item by a factor.</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.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>A new list with interpolated head and tail items.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedHeadAndTail_" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedHeadAndTail*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedHeadAndTail__2_System_Collections_Generic_List___1____0___0_System_Func___1___0__System_Func___0___0_System_Int32__System_Func___0___0___0__System_Func___0___0_System_Double__System_Func___1___1___1__System_Func___1_System_Double___1__" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedHeadAndTail``2(System.Collections.Generic.List{``1},``0,``0,System.Func{``1,``0},System.Func{``0,``0,System.Int32},System.Func{``0,``0,``0},System.Func{``0,``0,System.Double},System.Func{``1,``1,``1},System.Func{``1,System.Double,``1})">
GetSubListWithInterpolatedHeadAndTail&lt;TKey, TItem&gt;(List&lt;TItem&gt;, TKey, TKey, Func&lt;TItem, TKey&gt;, Func&lt;TKey, TKey, int&gt;, Func&lt;TKey, TKey, TKey&gt;, Func&lt;TKey, TKey, double&gt;, Func&lt;TItem, TItem, TItem&gt;, Func&lt;TItem, double, TItem&gt;)
</h3>
<div class="markdown level1 summary"><p>Creates a new list with interpolated head and tail items based on the specified key range.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static List&lt;TItem&gt; GetSubListWithInterpolatedHeadAndTail&lt;TKey, TItem&gt;(this List&lt;TItem&gt; src, TKey beginKey, TKey endKey, Func&lt;TItem, TKey&gt; getKeyFunc, Func&lt;TKey, TKey, int&gt; keyCompareFunc, Func&lt;TKey, TKey, TKey&gt; keyMinusFunc, Func&lt;TKey, TKey, double&gt; keyDivFunc, Func&lt;TItem, TItem, TItem&gt; itemAddingFunc, Func&lt;TItem, double, TItem&gt; itemScalingFunc)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>beginKey</code> <span class="xref">TKey</span></dt>
<dd><p>The beginning key of the range.</p>
</dd>
<dt><code>endKey</code> <span class="xref">TKey</span></dt>
<dd><p>The ending key of the range.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>keyCompareFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TKey, TKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</dt>
<dd><p>A function that compares two keys.</p>
</dd>
<dt><code>keyMinusFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TKey, TKey, TKey&gt;</dt>
<dd><p>A function that subtracts one key from another.</p>
</dd>
<dt><code>keyDivFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TKey, TKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>A function that divides one key by another to get a ratio.</p>
</dd>
<dt><code>itemAddingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItem, TItem&gt;</dt>
<dd><p>A function that adds two items together.</p>
</dd>
<dt><code>itemScalingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, TItem&gt;</dt>
<dd><p>A function that scales an item by a factor.</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.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>A new list with interpolated head and tail items.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TKey</code></dt>
<dd><p>The type of the key.</p>
</dd>
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedTail_" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedTail*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedTail__1_System_Collections_Generic_List___0__System_TimeSpan_System_Func___0_System_TimeSpan__System_Func___0___0___0__System_Func___0_System_Double___0__" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedTail``1(System.Collections.Generic.List{``0},System.TimeSpan,System.Func{``0,System.TimeSpan},System.Func{``0,``0,``0},System.Func{``0,System.Double,``0})">
GetSubListWithInterpolatedTail&lt;TItem&gt;(List&lt;TItem&gt;, TimeSpan, Func&lt;TItem, TimeSpan&gt;, Func&lt;TItem, TItem, TItem&gt;, Func&lt;TItem, double, TItem&gt;)
</h3>
<div class="markdown level1 summary"><p>Creates a new list with an interpolated tail item based on the specified TimeSpan key.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static List&lt;TItem&gt; GetSubListWithInterpolatedTail&lt;TItem&gt;(this List&lt;TItem&gt; src, TimeSpan endKey, Func&lt;TItem, TimeSpan&gt; getKeyFunc, Func&lt;TItem, TItem, TItem&gt; addingFunc, Func&lt;TItem, double, TItem&gt; scalingFunc)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>endKey</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a></dt>
<dd><p>The ending TimeSpan key for interpolation.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a>&gt;</dt>
<dd><p>A function that extracts the TimeSpan key from an item.</p>
</dd>
<dt><code>addingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItem, TItem&gt;</dt>
<dd><p>A function that adds two items together.</p>
</dd>
<dt><code>scalingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, TItem&gt;</dt>
<dd><p>A function that scales an item by a factor.</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.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>A new list with an interpolated tail item.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedTail_" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedTail*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedTail__2_System_Collections_Generic_List___1____0_System_Func___1___0__" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedTail``2(System.Collections.Generic.List{``1},``0,System.Func{``1,``0})">
GetSubListWithInterpolatedTail&lt;TKey, TItem&gt;(List&lt;TItem&gt;, TKey, Func&lt;TItem, TKey&gt;)
</h3>
<div class="markdown level1 summary"><p>Creates a new list with an interpolated tail item based on the specified key, using operators for both key and item operations.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static List&lt;TItem&gt; GetSubListWithInterpolatedTail&lt;TKey, TItem&gt;(this List&lt;TItem&gt; src, TKey endKey, Func&lt;TItem, TKey&gt; getKeyFunc) where TKey : IComparable&lt;TKey&gt;, ISubtractionOperators&lt;TKey, TKey, TKey&gt;, IDivisionOperators&lt;TKey, TKey, double&gt; where TItem : IAdditionOperators&lt;TItem, TItem, TItem&gt;, IMultiplyOperators&lt;TItem, double, TItem&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>endKey</code> <span class="xref">TKey</span></dt>
<dd><p>The ending key for interpolation.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</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.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>A new list with an interpolated tail item.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TKey</code></dt>
<dd><p>The type of the key, which must support comparison, subtraction, and division operators.</p>
</dd>
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list, which must support addition and multiplication operators.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedTail_" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedTail*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedTail__2_System_Collections_Generic_List___1____0_System_Func___1___0__System_Func___0___0_System_Int32__System_Func___0___0___0__System_Func___0___0_System_Double__System_Func___1___1___1__System_Func___1_System_Double___1__" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedTail``2(System.Collections.Generic.List{``1},``0,System.Func{``1,``0},System.Func{``0,``0,System.Int32},System.Func{``0,``0,``0},System.Func{``0,``0,System.Double},System.Func{``1,``1,``1},System.Func{``1,System.Double,``1})">
GetSubListWithInterpolatedTail&lt;TKey, TItem&gt;(List&lt;TItem&gt;, TKey, Func&lt;TItem, TKey&gt;, Func&lt;TKey, TKey, int&gt;, Func&lt;TKey, TKey, TKey&gt;, Func&lt;TKey, TKey, double&gt;, Func&lt;TItem, TItem, TItem&gt;, Func&lt;TItem, double, TItem&gt;)
</h3>
<div class="markdown level1 summary"><p>Creates a new list with an interpolated tail item based on the specified key.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static List&lt;TItem&gt; GetSubListWithInterpolatedTail&lt;TKey, TItem&gt;(this List&lt;TItem&gt; src, TKey endKey, Func&lt;TItem, TKey&gt; getKeyFunc, Func&lt;TKey, TKey, int&gt; keyCompareFunc, Func&lt;TKey, TKey, TKey&gt; keyMinusFunc, Func&lt;TKey, TKey, double&gt; keyDivFunc, Func&lt;TItem, TItem, TItem&gt; itemAddingFunc, Func&lt;TItem, double, TItem&gt; itemScalingFunc)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>endKey</code> <span class="xref">TKey</span></dt>
<dd><p>The ending key for interpolation.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>keyCompareFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TKey, TKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</dt>
<dd><p>A function that compares two keys.</p>
</dd>
<dt><code>keyMinusFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TKey, TKey, TKey&gt;</dt>
<dd><p>A function that subtracts one key from another.</p>
</dd>
<dt><code>keyDivFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TKey, TKey, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>&gt;</dt>
<dd><p>A function that divides one key by another to get a ratio.</p>
</dd>
<dt><code>itemAddingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItem, TItem&gt;</dt>
<dd><p>A function that adds two items together.</p>
</dd>
<dt><code>itemScalingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, TItem&gt;</dt>
<dd><p>A function that scales an item by a factor.</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.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>A new list with an interpolated tail item.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TKey</code></dt>
<dd><p>The type of the key.</p>
</dd>
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedTail_" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedTail*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetSubListWithInterpolatedTail__2_System_Collections_Generic_List___1____0_System_Func___1___0__System_Func___1___1___1__System_Func___1_System_Double___1__" data-uid="Hi.Common.Collections.ListUtil.GetSubListWithInterpolatedTail``2(System.Collections.Generic.List{``1},``0,System.Func{``1,``0},System.Func{``1,``1,``1},System.Func{``1,System.Double,``1})">
GetSubListWithInterpolatedTail&lt;TKey, TItem&gt;(List&lt;TItem&gt;, TKey, Func&lt;TItem, TKey&gt;, Func&lt;TItem, TItem, TItem&gt;, Func&lt;TItem, double, TItem&gt;)
</h3>
<div class="markdown level1 summary"><p>Creates a new list with an interpolated tail item based on the specified key, using operators for key operations.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static List&lt;TItem&gt; GetSubListWithInterpolatedTail&lt;TKey, TItem&gt;(this List&lt;TItem&gt; src, TKey endKey, Func&lt;TItem, TKey&gt; getKeyFunc, Func&lt;TItem, TItem, TItem&gt; addingFunc, Func&lt;TItem, double, TItem&gt; scalingFunc) where TKey : IComparable&lt;TKey&gt;, ISubtractionOperators&lt;TKey, TKey, TKey&gt;, IDivisionOperators&lt;TKey, TKey, double&gt;</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>The source list.</p>
</dd>
<dt><code>endKey</code> <span class="xref">TKey</span></dt>
<dd><p>The ending key for interpolation.</p>
</dd>
<dt><code>getKeyFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TItem, TKey&gt;</dt>
<dd><p>A function that extracts the key from an item.</p>
</dd>
<dt><code>addingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, TItem, TItem&gt;</dt>
<dd><p>A function that adds two items together.</p>
</dd>
<dt><code>scalingFunc</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TItem, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a>, TItem&gt;</dt>
<dd><p>A function that scales an item by a factor.</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.list-1">List</a>&lt;TItem&gt;</dt>
<dd><p>A new list with an interpolated tail item.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TKey</code></dt>
<dd><p>The type of the key, which must support comparison, subtraction, and division operators.</p>
</dd>
<dt><code>TItem</code></dt>
<dd><p>The type of items in the list.</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_GetSubList_" data-uid="Hi.Common.Collections.ListUtil.GetSubList*"></a>
<h3 id="Hi_Common_Collections_ListUtil_GetSubList__1_System_Collections_Generic_IList___0__System_Int32_System_Int32_" data-uid="Hi.Common.Collections.ListUtil.GetSubList``1(System.Collections.Generic.IList{``0},System.Int32,System.Int32)">
GetSubList&lt;TItem&gt;(IList&lt;TItem&gt;, int, int)
</h3>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static SubList&lt;TItem&gt; GetSubList&lt;TItem&gt;(this IList&lt;TItem&gt; src, int beginIndex, int endIndex)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd></dd>
<dt><code>beginIndex</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd></dd>
<dt><code>endIndex</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd></dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="Hi.Common.Collections.SubList-1.html">SubList</a>&lt;TItem&gt;</dt>
<dd></dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd></dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_Swap_" data-uid="Hi.Common.Collections.ListUtil.Swap*"></a>
<h3 id="Hi_Common_Collections_ListUtil_Swap__1_System_Collections_Generic_IList___0__System_Int32_System_Int32_" data-uid="Hi.Common.Collections.ListUtil.Swap``1(System.Collections.Generic.IList{``0},System.Int32,System.Int32)">
Swap&lt;TItem&gt;(IList&lt;TItem&gt;, int, int)
</h3>
<div class="markdown level1 summary"><p>Swaps two elements in a list at the specified indices.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void Swap&lt;TItem&gt;(this IList&lt;TItem&gt; src, int indexA, int indexB)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>src</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</dt>
<dd><p>The source list</p>
</dd>
<dt><code>indexA</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The index of the first element to swap</p>
</dd>
<dt><code>indexB</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The index of the second element to swap</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TItem</code></dt>
<dd><p>The type of elements in the list</p>
</dd>
</dl>
<a id="Hi_Common_Collections_ListUtil_TestFloorCeil_" data-uid="Hi.Common.Collections.ListUtil.TestFloorCeil*"></a>
<h3 id="Hi_Common_Collections_ListUtil_TestFloorCeil" data-uid="Hi.Common.Collections.ListUtil.TestFloorCeil">
TestFloorCeil()
</h3>
<div class="markdown level1 summary"><p>Tests the floor and ceiling functionality with sample data.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void TestFloorCeil()</code></pre>
</div>
</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> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>