次の方法で共有


BlockingCollection<T> クラス

定義

IProducerConsumerCollection<T>を実装するスレッド セーフなコレクションのブロック機能と境界機能を提供します。

generic <typename T>
public ref class BlockingCollection : IDisposable, System::Collections::Generic::IEnumerable<T>, System::Collections::Generic::IReadOnlyCollection<T>, System::Collections::ICollection
generic <typename T>
public ref class BlockingCollection : IDisposable, System::Collections::Generic::IEnumerable<T>, System::Collections::ICollection
public class BlockingCollection<T> : IDisposable, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.ICollection
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public class BlockingCollection<T> : IDisposable, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.ICollection
[System.Runtime.InteropServices.ComVisible(false)]
public class BlockingCollection<T> : IDisposable, System.Collections.Generic.IEnumerable<T>, System.Collections.ICollection
[System.Runtime.InteropServices.ComVisible(false)]
public class BlockingCollection<T> : IDisposable, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.ICollection
public class BlockingCollection<T> : IDisposable, System.Collections.Generic.IEnumerable<T>, System.Collections.ICollection
type BlockingCollection<'T> = class
    interface seq<'T>
    interface IEnumerable
    interface IReadOnlyCollection<'T>
    interface ICollection
    interface IDisposable
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
type BlockingCollection<'T> = class
    interface seq<'T>
    interface IEnumerable
    interface IReadOnlyCollection<'T>
    interface ICollection
    interface IDisposable
[<System.Runtime.InteropServices.ComVisible(false)>]
type BlockingCollection<'T> = class
    interface seq<'T>
    interface ICollection
    interface IEnumerable
    interface IDisposable
[<System.Runtime.InteropServices.ComVisible(false)>]
type BlockingCollection<'T> = class
    interface seq<'T>
    interface IEnumerable
    interface ICollection
    interface IDisposable
    interface IReadOnlyCollection<'T>
type BlockingCollection<'T> = class
    interface seq<'T>
    interface ICollection
    interface IEnumerable
    interface IDisposable
Public Class BlockingCollection(Of T)
Implements ICollection, IDisposable, IEnumerable(Of T), IReadOnlyCollection(Of T)
Public Class BlockingCollection(Of T)
Implements ICollection, IDisposable, IEnumerable(Of T)

型パラメーター

T

コレクション内の要素の型。

継承
BlockingCollection<T>
属性
実装

次の例は、ブロックコレクションから同時に項目を追加および取得する方法を示しています。

using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;

class BlockingCollectionDemo
{
    static async Task Main()
    {
        await AddTakeDemo.BC_AddTakeCompleteAdding();
        TryTakeDemo.BC_TryTake();
        FromToAnyDemo.BC_FromToAny();
        await ConsumingEnumerableDemo.BC_GetConsumingEnumerable();
        Console.WriteLine("Press any key to exit.");
        Console.ReadKey();
    }
}
class AddTakeDemo
{
    // Demonstrates:
    //      BlockingCollection<T>.Add()
    //      BlockingCollection<T>.Take()
    //      BlockingCollection<T>.CompleteAdding()
    public static async Task BC_AddTakeCompleteAdding()
    {
        using (BlockingCollection<int> bc = new BlockingCollection<int>())
        {
            // Spin up a Task to populate the BlockingCollection
            Task t1 = Task.Run(() =>
            {
                bc.Add(1);
                bc.Add(2);
                bc.Add(3);
                bc.CompleteAdding();
            });

            // Spin up a Task to consume the BlockingCollection
            Task t2 = Task.Run(() =>
            {
                try
                {
                    // Consume the BlockingCollection
                    while (true) Console.WriteLine(bc.Take());
                }
                catch (InvalidOperationException)
                {
                    // An InvalidOperationException means that Take() was called on a completed collection
                    Console.WriteLine("That's All!");
                }
            });

            await Task.WhenAll(t1, t2);
        }
    }
}

class TryTakeDemo
{
    // Demonstrates:
    //      BlockingCollection<T>.Add()
    //      BlockingCollection<T>.CompleteAdding()
    //      BlockingCollection<T>.TryTake()
    //      BlockingCollection<T>.IsCompleted
    public static void BC_TryTake()
    {
        // Construct and fill our BlockingCollection
        using (BlockingCollection<int> bc = new BlockingCollection<int>())
        {
            int NUMITEMS = 10000;
            for (int i = 0; i < NUMITEMS; i++) bc.Add(i);
            bc.CompleteAdding();
            int outerSum = 0;

            // Delegate for consuming the BlockingCollection and adding up all items
            Action action = () =>
            {
                int localItem;
                int localSum = 0;

                while (bc.TryTake(out localItem)) localSum += localItem;
                Interlocked.Add(ref outerSum, localSum);
            };

            // Launch three parallel actions to consume the BlockingCollection
            Parallel.Invoke(action, action, action);

            Console.WriteLine("Sum[0..{0}) = {1}, should be {2}", NUMITEMS, outerSum, ((NUMITEMS * (NUMITEMS - 1)) / 2));
            Console.WriteLine("bc.IsCompleted = {0} (should be true)", bc.IsCompleted);
        }
    }
}

class FromToAnyDemo
{
    // Demonstrates:
    //      Bounded BlockingCollection<T>
    //      BlockingCollection<T>.TryAddToAny()
    //      BlockingCollection<T>.TryTakeFromAny()
    public static void BC_FromToAny()
    {
        BlockingCollection<int>[] bcs = new BlockingCollection<int>[2];
        bcs[0] = new BlockingCollection<int>(5); // collection bounded to 5 items
        bcs[1] = new BlockingCollection<int>(5); // collection bounded to 5 items

        // Should be able to add 10 items w/o blocking
        int numFailures = 0;
        for (int i = 0; i < 10; i++)
        {
            if (BlockingCollection<int>.TryAddToAny(bcs, i) == -1) numFailures++;
        }
        Console.WriteLine("TryAddToAny: {0} failures (should be 0)", numFailures);

        // Should be able to retrieve 10 items
        int numItems = 0;
        int item;
        while (BlockingCollection<int>.TryTakeFromAny(bcs, out item) != -1) numItems++;
        Console.WriteLine("TryTakeFromAny: retrieved {0} items (should be 10)", numItems);
    }
}

class ConsumingEnumerableDemo
{
    // Demonstrates:
    //      BlockingCollection<T>.Add()
    //      BlockingCollection<T>.CompleteAdding()
    //      BlockingCollection<T>.GetConsumingEnumerable()
    public static async Task BC_GetConsumingEnumerable()
    {
        using (BlockingCollection<int> bc = new BlockingCollection<int>())
        {
            // Kick off a producer task
            var producerTask = Task.Run(async () =>
            {
                for (int i = 0; i < 10; i++)
                {
                    bc.Add(i);
                    Console.WriteLine($"Producing: {i}");

                    await Task.Delay(100); // sleep 100 ms between adds
                }

                // Need to do this to keep foreach below from hanging
                bc.CompleteAdding();
            });

            // Now consume the blocking collection with foreach.
            // Use bc.GetConsumingEnumerable() instead of just bc because the
            // former will block waiting for completion and the latter will
            // simply take a snapshot of the current state of the underlying collection.
            foreach (var item in bc.GetConsumingEnumerable())
            {
                Console.WriteLine($"Consuming: {item}");
            }
            await producerTask; // Allow task to complete cleanup
        }
    }
}
open System
open System.Collections.Concurrent
open System.Threading
open System.Threading.Tasks

module AddTakeDemo =
    // Demonstrates:
    //      BlockingCollection<T>.Add()
    //      BlockingCollection<T>.Take()
    //      BlockingCollection<T>.CompleteAdding()
    let blockingCollectionAddTakeCompleteAdding () =
        task {
            use bc = new BlockingCollection<int>()
            // Spin up a Task to populate the BlockingCollection
            let t1 = 
                task {
                    bc.Add 1
                    bc.Add 2
                    bc.Add 3
                    bc.CompleteAdding()
                }

            // Spin up a Task to consume the BlockingCollection
            let t2 = 
                task {
                    try
                        // Consume consume the BlockingCollection
                        while true do 
                            printfn $"{bc.Take()}"
                    with :? InvalidOperationException ->
                        // An InvalidOperationException means that Take() was called on a completed collection
                        printfn "That's All!"
                }
            let! _ = Task.WhenAll(t1, t2)
            ()
        }

module TryTakeDemo =
    // Demonstrates:
    //      BlockingCollection<T>.Add()
    //      BlockingCollection<T>.CompleteAdding()
    //      BlockingCollection<T>.TryTake()
    //      BlockingCollection<T>.IsCompleted
    let blockingCollectionTryTake () =
        // Construct and fill our BlockingCollection
        use bc = new BlockingCollection<int>()
        let NUMITEMS = 10000;
        for i = 0 to NUMITEMS - 1 do
            bc.Add i
        bc.CompleteAdding()
        let mutable outerSum = 0

        // Delegate for consuming the BlockingCollection and adding up all items
        let action = 
            Action(fun () ->
                let mutable localItem = 0
                let mutable localSum = 0

                while bc.TryTake &localItem do
                    localSum <- localSum + localItem
                Interlocked.Add(&outerSum, localSum)
                |> ignore)

        // Launch three parallel actions to consume the BlockingCollection
        Parallel.Invoke(action, action, action)

        printfn $"Sum[0..{NUMITEMS}) = {outerSum}, should be {((NUMITEMS * (NUMITEMS - 1)) / 2)}"
        printfn $"bc.IsCompleted = {bc.IsCompleted} (should be true)"

module FromToAnyDemo =
    // Demonstrates:
    //      Bounded BlockingCollection<T>
    //      BlockingCollection<T>.TryAddToAny()
    //      BlockingCollection<T>.TryTakeFromAny()
    let blockingCollectionFromToAny () =
        let bcs = 
            [|
                new BlockingCollection<int>(5) // collection bounded to 5 items
                new BlockingCollection<int>(5) // collection bounded to 5 items
             |]
        // Should be able to add 10 items w/o blocking
        let mutable numFailures = 0;
        for i = 0 to 9 do
            if BlockingCollection<int>.TryAddToAny(bcs, i) = -1 then
                numFailures <- numFailures + 1
        printfn $"TryAddToAny: {numFailures} failures (should be 0)"

        // Should be able to retrieve 10 items
        let mutable numItems = 0
        let mutable item = 0
        while BlockingCollection<int>.TryTakeFromAny(bcs, &item) <> -1 do
            numItems <- numItems + 1
        printfn $"TryTakeFromAny: retrieved {numItems} items (should be 10)"

module ConsumingEnumerableDemo =
    // Demonstrates:
    //      BlockingCollection<T>.Add()
    //      BlockingCollection<T>.CompleteAdding()
    //      BlockingCollection<T>.GetConsumingEnumerable()
    let blockingCollectionGetConsumingEnumerable () =
        task {
            use bc = new BlockingCollection<int>()
            // Kick off a producer task
            let producerTask =
                task {
                    for i = 0 to 9 do
                        bc.Add i
                        printfn $"Producing: {i}"

                        do! Task.Delay 100 // sleep 100 ms between adds
                    // Need to do this to keep foreach below from hanging
                    bc.CompleteAdding()
                }

            // Now consume the blocking collection with foreach.
            // Use bc.GetConsumingEnumerable() instead of just bc because the
            // former will block waiting for completion and the latter will
            // simply take a snapshot of the current state of the underlying collection.
            for item in bc.GetConsumingEnumerable() do
                printfn $"Consuming: {item}"
            do! producerTask // Allow task to complete cleanup
        }

let main =
    task {
        do! AddTakeDemo.blockingCollectionAddTakeCompleteAdding ()
        TryTakeDemo.blockingCollectionTryTake ()
        FromToAnyDemo.blockingCollectionFromToAny ()
        do! ConsumingEnumerableDemo.blockingCollectionGetConsumingEnumerable ()
        printfn "Press any key to exit."
        Console.ReadKey(true) |> ignore
    }
main.Wait()
Imports System.Threading.Tasks
Imports System.Collections.Concurrent
Imports System.Threading

Class BlockingCollectionDemo
    Shared Sub Main()
        AddTakeDemo.BC_AddTakeCompleteAdding()
        TryTakeDemo.BC_TryTake()
        ToAnyDemo.BC_ToAny()
        ConsumingEnumerableDemo.BC_GetConsumingEnumerable()
        ' Keep the console window open in debug mode
        Console.WriteLine("Press any key to exit.")
        Console.ReadKey()
    End Sub
End Class

Class AddTakeDemo

    ' Demonstrates:
    ' BlockingCollection<T>.Add()
    ' BlockingCollection<T>.Take()
    ' BlockingCollection<T>.CompleteAdding()
    Shared Sub BC_AddTakeCompleteAdding()
        Using bc As New BlockingCollection(Of Integer)()

            ' Spin up a Task to populate the BlockingCollection 
            Using t1 As Task = Task.Factory.StartNew(
                Sub()
                    bc.Add(1)
                    bc.Add(2)
                    bc.Add(3)
                    bc.CompleteAdding()
                End Sub)
                ' Spin up a Task to consume the BlockingCollection
                Using t2 As Task = Task.Factory.StartNew(
                Sub()
                    Try
                        ' Consume the BlockingCollection
                        While True
                            Console.WriteLine(bc.Take())
                        End While
                    Catch generatedExceptionName As InvalidOperationException
                        ' An InvalidOperationException means that Take() was called on a completed collection
                        Console.WriteLine("That's All!")
                    End Try
                End Sub)

                    Task.WaitAll(t1, t2)
                End Using
            End Using
        End Using
    End Sub



End Class

'Imports System.Collections.Concurrent
'Imports System.Threading
'Imports System.Threading.Tasks

Class TryTakeDemo
    ' Demonstrates:
    ' BlockingCollection<T>.Add()
    ' BlockingCollection<T>.CompleteAdding()
    ' BlockingCollection<T>.TryTake()
    ' BlockingCollection<T>.IsCompleted
    Shared Sub BC_TryTake()
        ' Construct and fill our BlockingCollection
        Using bc As New BlockingCollection(Of Integer)()
            Dim NUMITEMS As Integer = 10000
            For i As Integer = 0 To NUMITEMS - 1
                bc.Add(i)
            Next
            bc.CompleteAdding()
            Dim outerSum As Integer = 0

            ' Delegate for consuming the BlockingCollection and adding up all items
            Dim action As Action =
                Sub()
                    Dim localItem As Integer
                    Dim localSum As Integer = 0

                    While bc.TryTake(localItem)
                        localSum += localItem
                    End While
                    Interlocked.Add(outerSum, localSum)
                End Sub

            ' Launch three parallel actions to consume the BlockingCollection
            Parallel.Invoke(action, action, action)

            Console.WriteLine("Sum[0..{0}) = {1}, should be {2}", NUMITEMS, outerSum, ((NUMITEMS * (NUMITEMS - 1)) / 2))
            Console.WriteLine("bc.IsCompleted = {0} (should be true)", bc.IsCompleted)
        End Using
    End Sub

End Class

'Imports System.Threading.Tasks
'Imports System.Collections.Concurrent

' Demonstrates:
' Bounded BlockingCollection<T>
' BlockingCollection<T>.TryAddToAny()
' BlockingCollection<T>.TryTakeFromAny()
Class ToAnyDemo
    Shared Sub BC_ToAny()
        Dim bcs As BlockingCollection(Of Integer)() = New BlockingCollection(Of Integer)(1) {}
        bcs(0) = New BlockingCollection(Of Integer)(5)
        ' collection bounded to 5 items
        bcs(1) = New BlockingCollection(Of Integer)(5)
        ' collection bounded to 5 items
        ' Should be able to add 10 items w/o blocking
        Dim numFailures As Integer = 0
        For i As Integer = 0 To 9
            If BlockingCollection(Of Integer).TryAddToAny(bcs, i) = -1 Then
                numFailures += 1
            End If
        Next
        Console.WriteLine("TryAddToAny: {0} failures (should be 0)", numFailures)

        ' Should be able to retrieve 10 items
        Dim numItems As Integer = 0
        Dim item As Integer
        While BlockingCollection(Of Integer).TryTakeFromAny(bcs, item) <> -1
            numItems += 1
        End While
        Console.WriteLine("TryTakeFromAny: retrieved {0} items (should be 10)", numItems)
    End Sub
End Class

'Imports System.Threading.Tasks
'Imports System.Collections.Concurrent

' Demonstrates:
' BlockingCollection<T>.Add()
' BlockingCollection<T>.CompleteAdding()
' BlockingCollection<T>.GetConsumingEnumerable()

Class ConsumingEnumerableDemo
    Shared Sub BC_GetConsumingEnumerable()
        Using bc As New BlockingCollection(Of Integer)()

            ' Kick off a producer task
            Task.Factory.StartNew(
                Sub()
                    For i As Integer = 0 To 9
                        bc.Add(i)
                        ' sleep 100 ms between adds
                        Thread.Sleep(100)
                    Next

                    ' Need to do this to keep foreach below from not responding.
                    bc.CompleteAdding()
                End Sub)
            ' Now consume the blocking collection with foreach.
            ' Use bc.GetConsumingEnumerable() instead of just bc because the
            ' former will block waiting for completion and the latter will
            ' simply take a snapshot of the current state of the underlying collection.
            For Each item In bc.GetConsumingEnumerable()
                Console.WriteLine(item)
            Next
        End Using
    End Sub
End Class

注釈

BlockingCollection<T> は、以下を提供するスレッド セーフなコレクション クラスです。

  • プロデューサー/コンシューマー パターンの実装。BlockingCollection<T> は、IProducerConsumerCollection<T> インターフェイスのラッパーです。

  • Add メソッドと Take メソッドを使用した複数のスレッドからの項目の同時追加と削除。

  • コレクションがいっぱいまたは空の場合に Add 操作と Take 操作をブロックする境界付きコレクション。

  • TryAdd または TryTake メソッドで CancellationToken オブジェクトを使用して、Add または Take 操作を取り消します。

大事な

この型は、IDisposable インターフェイスを実装します。 型の使用が完了したら、直接または間接的に破棄する必要があります。 型を直接破棄するには、try/catch ブロックでその Dispose メソッドを呼び出します。 間接的に破棄するには、using (C#) や Using (Visual Basic) などの言語コンストラクトを使用します。 詳細については、「IDisposable インターフェイス」トピックの「IDisposable を実装するオブジェクトの使用」セクションを参照してください。 また、Dispose() メソッドはスレッド セーフではないことに注意してください。 BlockingCollection<T> の他のすべてのパブリック メンバーと保護されたメンバーはスレッド セーフであり、複数のスレッドから同時に使用できます。

IProducerConsumerCollection<T> は、スレッド セーフなデータの追加と削除を可能にするコレクションを表します。 BlockingCollection<T> は、IProducerConsumerCollection<T> インスタンスのラッパーとして使用され、データを削除できるようになるまでコレクションからの削除試行をブロックできます。 同様に、BlockingCollection<T> を作成して、IProducerConsumerCollection<T>で許可されているデータ要素の数に上限を適用できます。コレクションに対する追加の試行は、追加された項目を格納するための領域が使用可能になるまでブロックされる可能性があります。 この方法では、BlockingCollection<T> は従来のブロッキング キュー データ構造に似ていますが、基になるデータ ストレージ メカニズムが IProducerConsumerCollection<T>として抽象化される点が異なります。

BlockingCollection<T> では、境界とブロックがサポートされます。 境界は、コレクションの最大容量を設定できることを意味します。 境界は、メモリ内のコレクションの最大サイズを制御できるため、特定のシナリオで重要です。これにより、生成されるスレッドが消費するスレッドの前に移動しすぎなくなります。複数のスレッドまたはタスクが同時にコレクションに項目を追加でき、コレクションが指定された最大容量に達すると、アイテムが削除されるまで生成スレッドはブロックされます。 複数のコンシューマーが同時に項目を削除でき、コレクションが空になると、プロデューサーが項目を追加するまで、消費スレッドはブロックされます。 生成スレッドは、CompleteAdding メソッドを呼び出して、追加される項目がないことを示すことができます。 コンシューマーは、IsCompleted プロパティを監視して、コレクションが空で項目が追加されないタイミングを確認します。

通常、Add 操作と Take 操作はループで実行されます。 ループを取り消すには、CancellationToken オブジェクトを TryAdd メソッドまたは TryTake メソッドに渡し、各反復処理でトークンの IsCancellationRequested プロパティの値を確認します。 値が true場合は、リソースをクリーンアップしてループを終了することで、取り消し要求に応答する必要があります。

BlockingCollection<T> オブジェクトを作成する場合は、バインドされた容量だけでなく、使用するコレクションの種類も指定できます。 たとえば、先入れ先出し (FIFO) 動作に対して ConcurrentQueue<T> オブジェクトを指定したり、最後の入力、先入れ先出し (LIFO) 動作に ConcurrentStack<T> オブジェクトを指定したりできます。 IProducerConsumerCollection<T> インターフェイスを実装する任意のコレクション クラスを使用できます。 BlockingCollection<T> の既定のコレクションの種類は ConcurrentQueue<T>です。

基になるコレクションを直接変更しないでください。 BlockingCollection<T> メソッドを使用して要素を追加または削除します。 基になるコレクションを直接変更すると、BlockingCollection<T> オブジェクトが破損する可能性があります。

BlockingCollection<T> は非同期アクセスを念頭に置いて設計されていません。 アプリケーションで非同期プロデューサー/コンシューマー シナリオが必要な場合は、代わりに Channel<T> の使用を検討してください。

コンストラクター

BlockingCollection<T>()

BlockingCollection<T> クラスの新しいインスタンスを、上限なしで初期化します。

BlockingCollection<T>(Int32)

指定した上限を使用して、BlockingCollection<T> クラスの新しいインスタンスを初期化します。

BlockingCollection<T>(IProducerConsumerCollection<T>)

指定された IProducerConsumerCollection<T> を基になるデータ ストアとして使用して、上限を指定せずに、BlockingCollection<T> クラスの新しいインスタンスを初期化します。

BlockingCollection<T>(IProducerConsumerCollection<T>, Int32)

指定した上限を使用し、指定した IProducerConsumerCollection<T> を基になるデータ ストアとして使用して、BlockingCollection<T> クラスの新しいインスタンスを初期化します。

プロパティ

BoundedCapacity

この BlockingCollection<T> インスタンスの有界容量を取得します。

Count

BlockingCollection<T>に含まれる項目の数を取得します。

IsAddingCompleted

この BlockingCollection<T> が追加のために完了としてマークされているかどうかを取得します。

IsCompleted

この BlockingCollection<T> が追加のために完了としてマークされ、空であるかどうかを取得します。

メソッド

Add(T)

BlockingCollection<T>に項目を追加します。

Add(T, CancellationToken)

BlockingCollection<T>に項目を追加します。

AddToAny(BlockingCollection<T>[], T)

指定した項目を、指定した BlockingCollection<T> インスタンスのいずれかに追加します。

AddToAny(BlockingCollection<T>[], T, CancellationToken)

指定した項目を、指定した BlockingCollection<T> インスタンスのいずれかに追加します。

CompleteAdding()

BlockingCollection<T> インスタンスに追加を受け入れないことをマークします。

CopyTo(T[], Int32)

ターゲット配列の指定したインデックスから始まる、BlockingCollection<T> インスタンス内のすべての項目を互換性のある 1 次元配列にコピーします。

Dispose()

BlockingCollection<T> クラスの現在のインスタンスで使用されているすべてのリソースを解放します。

Dispose(Boolean)

BlockingCollection<T> インスタンスによって使用されるリソースを解放します。

Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetConsumingEnumerable()

コレクション内の項目の使用 IEnumerable<T> を提供します。

GetConsumingEnumerable(CancellationToken)

コレクション内の項目の使用 IEnumerable<T> を提供します。

GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
Take()

BlockingCollection<T>から項目を削除します。

Take(CancellationToken)

BlockingCollection<T>から項目を削除します。

TakeFromAny(BlockingCollection<T>[], T)

指定した BlockingCollection<T> インスタンスのいずれかから項目を取得します。

TakeFromAny(BlockingCollection<T>[], T, CancellationToken)

指定したキャンセル トークンを監視しながら、指定した BlockingCollection<T> インスタンスのいずれかから項目を取得します。

ToArray()

BlockingCollection<T> インスタンスから新しい配列に項目をコピーします。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
TryAdd(T)

指定した項目を BlockingCollection<T>に追加しようとします。

TryAdd(T, Int32)

指定した期間内に、指定した項目を BlockingCollection<T> に追加しようとします。

TryAdd(T, Int32, CancellationToken)

キャンセル トークンを監視しながら、指定した期間内に指定した項目を BlockingCollection<T> に追加しようとします。

TryAdd(T, TimeSpan)

指定した項目を BlockingCollection<T>に追加しようとします。

TryAddToAny(BlockingCollection<T>[], T)

指定した BlockingCollection<T> インスタンスのいずれかに、指定した項目の追加を試みます。

TryAddToAny(BlockingCollection<T>[], T, Int32)

指定した BlockingCollection<T> インスタンスのいずれかに、指定した項目の追加を試みます。

TryAddToAny(BlockingCollection<T>[], T, Int32, CancellationToken)

指定した BlockingCollection<T> インスタンスのいずれかに、指定した項目の追加を試みます。

TryAddToAny(BlockingCollection<T>[], T, TimeSpan)

指定したキャンセル トークンを監視しながら、指定した BlockingCollection<T> インスタンスのいずれかに指定した項目を追加しようとします。

TryTake(T)

BlockingCollection<T>から項目の削除を試みます。

TryTake(T, Int32)

指定した期間内の BlockingCollection<T> から項目の削除を試みます。

TryTake(T, Int32, CancellationToken)

キャンセル トークンを監視しながら、指定した期間内に BlockingCollection<T> から項目を削除しようとします。

TryTake(T, TimeSpan)

指定した期間内の BlockingCollection<T> から項目の削除を試みます。

TryTakeFromAny(BlockingCollection<T>[], T)

指定した BlockingCollection<T> インスタンスのいずれかから項目の削除を試みます。

TryTakeFromAny(BlockingCollection<T>[], T, Int32)

指定した BlockingCollection<T> インスタンスのいずれかから項目の削除を試みます。

TryTakeFromAny(BlockingCollection<T>[], T, Int32, CancellationToken)

指定した BlockingCollection<T> インスタンスのいずれかから項目の削除を試みます。

TryTakeFromAny(BlockingCollection<T>[], T, TimeSpan)

指定した BlockingCollection<T> インスタンスのいずれかから項目の削除を試みます。

明示的なインターフェイスの実装

ICollection.CopyTo(Array, Int32)

ターゲット配列の指定したインデックスから始まる、BlockingCollection<T> インスタンス内のすべての項目を互換性のある 1 次元配列にコピーします。

ICollection.IsSynchronized

ICollection へのアクセスが同期されているかどうかを示す値を取得します (スレッド セーフ)。

ICollection.SyncRoot

ICollectionへのアクセスを同期するために使用できるオブジェクトを取得します。 このプロパティはサポートされていません。

IEnumerable.GetEnumerator()

コレクション内の項目の IEnumerator を提供します。

IEnumerable<T>.GetEnumerator()

コレクション内の項目の IEnumerator<T> を提供します。

拡張メソッド

ToFrozenDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

指定したキー セレクター関数に従って、IEnumerable<T> から FrozenDictionary<TKey,TValue> を作成します。

ToFrozenDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

指定したキー セレクターおよび要素セレクター関数に従って、IEnumerable<T> から FrozenDictionary<TKey,TValue> を作成します。

ToFrozenSet<T>(IEnumerable<T>, IEqualityComparer<T>)

指定した値を使用して FrozenSet<T> を作成します。

ToImmutableArray<TSource>(IEnumerable<TSource>)

指定したコレクションから変更できない配列を作成します。

ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

変換関数をソース キーに適用して、要素の既存のコレクションから変更できないディクショナリを構築します。

ToImmutableDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

シーケンスの変換に基づいて、変更できないディクショナリを構築します。

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)

シーケンスを列挙して変換し、その内容の変更できないディクショナリを生成します。

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>)

シーケンスを列挙して変換し、指定したキー比較子を使用してその内容の変更できないディクショナリを生成します。

ToImmutableDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IEqualityComparer<TKey>, IEqualityComparer<TValue>)

シーケンスを列挙して変換し、指定したキーと値の比較子を使用してその内容の変更できないディクショナリを生成します。

ToImmutableHashSet<TSource>(IEnumerable<TSource>)

シーケンスを列挙し、その内容の変更できないハッシュ セットを生成します。

ToImmutableHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

シーケンスを列挙し、その内容の変更できないハッシュ セットを生成し、セット型に対して指定された等値比較子を使用します。

ToImmutableList<TSource>(IEnumerable<TSource>)

シーケンスを列挙し、その内容の変更できないリストを生成します。

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>)

シーケンスを列挙して変換し、その内容の変更できない並べ替えられたディクショナリを生成します。

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IComparer<TKey>)

シーケンスを列挙して変換し、指定したキー比較子を使用して、その内容の変更できない並べ替えられたディクショナリを生成します。

ToImmutableSortedDictionary<TSource,TKey,TValue>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TValue>, IComparer<TKey>, IEqualityComparer<TValue>)

シーケンスを列挙して変換し、指定したキーと値の比較子を使用して、その内容の変更できない並べ替えられたディクショナリを生成します。

ToImmutableSortedSet<TSource>(IEnumerable<TSource>)

シーケンスを列挙し、その内容の変更できない並べ替えられたセットを生成します。

ToImmutableSortedSet<TSource>(IEnumerable<TSource>, IComparer<TSource>)

シーケンスを列挙し、その内容の変更できない並べ替えられたセットを生成し、指定された比較子を使用します。

CopyToDataTable<T>(IEnumerable<T>)

ジェネリック パラメーター TDataRowされている入力 IEnumerable<T> オブジェクトを指定して、DataRow オブジェクトのコピーを格納する DataTable を返します。

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

ジェネリック パラメーター TDataRowされている入力 IEnumerable<T> オブジェクトが指定された DataTableDataRow オブジェクトをコピーします。

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

ジェネリック パラメーター TDataRowされている入力 IEnumerable<T> オブジェクトが指定された DataTableDataRow オブジェクトをコピーします。

Aggregate<TSource>(IEnumerable<TSource>, Func<TSource,TSource,TSource>)

アキュムレータ関数をシーケンスに適用します。

Aggregate<TSource,TAccumulate>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>)

アキュムレータ関数をシーケンスに適用します。 指定されたシード値は、初期アキュムレータ値として使用されます。

Aggregate<TSource,TAccumulate,TResult>(IEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, Func<TAccumulate,TResult>)

アキュムレータ関数をシーケンスに適用します。 指定したシード値が初期アキュムレータ値として使用され、指定された関数を使用して結果値が選択されます。

AggregateBy<TSource,TKey,TAccumulate>(IEnumerable<TSource>, Func<TSource, TKey>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, IEqualityComparer<TKey>)

IProducerConsumerCollection<T>を実装するスレッド セーフなコレクションのブロック機能と境界機能を提供します。

AggregateBy<TSource,TKey,TAccumulate>(IEnumerable<TSource>, Func<TSource, TKey>, Func<TKey,TAccumulate>, Func<TAccumulate,TSource,TAccumulate>, IEqualityComparer<TKey>)

IProducerConsumerCollection<T>を実装するスレッド セーフなコレクションのブロック機能と境界機能を提供します。

All<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

シーケンスのすべての要素が条件を満たすかどうかを判断します。

Any<TSource>(IEnumerable<TSource>)

シーケンスに要素が含まれているかどうかを判断します。

Any<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

シーケンスの要素が条件を満たすかどうかを判断します。

Append<TSource>(IEnumerable<TSource>, TSource)

シーケンスの末尾に値を追加します。

AsEnumerable<TSource>(IEnumerable<TSource>)

IEnumerable<T>として入力された入力を返します。

Average<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される Decimal 値のシーケンスの平均を計算します。

Average<TSource>(IEnumerable<TSource>, Func<TSource,Double>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される Double 値のシーケンスの平均を計算します。

Average<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される Int32 値のシーケンスの平均を計算します。

Average<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される Int64 値のシーケンスの平均を計算します。

Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される null 許容 Decimal 値のシーケンスの平均を計算します。

Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される null 許容 Double 値のシーケンスの平均を計算します。

Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される null 許容 Int32 値のシーケンスの平均を計算します。

Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される null 許容 Int64 値のシーケンスの平均を計算します。

Average<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される null 許容 Single 値のシーケンスの平均を計算します。

Average<TSource>(IEnumerable<TSource>, Func<TSource,Single>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される Single 値のシーケンスの平均を計算します。

Cast<TResult>(IEnumerable)

IEnumerable の要素を指定した型にキャストします。

Chunk<TSource>(IEnumerable<TSource>, Int32)

シーケンスの要素を最大 sizeサイズのチャンクに分割します。

Concat<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)

2 つのシーケンスを連結します。

Contains<TSource>(IEnumerable<TSource>, TSource)

既定の等値比較子を使用して、シーケンスに指定した要素が含まれているかどうかを判断します。

Contains<TSource>(IEnumerable<TSource>, TSource, IEqualityComparer<TSource>)

指定した IEqualityComparer<T>を使用して、シーケンスに指定した要素が含まれているかどうかを判断します。

Count<TSource>(IEnumerable<TSource>)

シーケンス内の要素の数を返します。

Count<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

指定したシーケンス内の 1 つの条件を満たす要素の数を表す数値を返します。

CountBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

IProducerConsumerCollection<T>を実装するスレッド セーフなコレクションのブロック機能と境界機能を提供します。

DefaultIfEmpty<TSource>(IEnumerable<TSource>)

シーケンスが空の場合は、指定したシーケンスの要素、またはシングルトン コレクション内の型パラメーターの既定値を返します。

DefaultIfEmpty<TSource>(IEnumerable<TSource>, TSource)

シーケンスが空の場合は、指定したシーケンスの要素、またはシングルトン コレクション内の指定した値を返します。

Distinct<TSource>(IEnumerable<TSource>)

既定の等値比較子を使用して値を比較することにより、シーケンスから個別の要素を返します。

Distinct<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

指定した IEqualityComparer<T> を使用して値を比較することにより、シーケンスから個別の要素を返します。

DistinctBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

指定したキー セレクター関数に従って、シーケンスから個別の要素を返します。

DistinctBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

指定したキー セレクター関数に従ってシーケンスから個別の要素を返し、指定した比較子を使用してキーを比較します。

ElementAt<TSource>(IEnumerable<TSource>, Index)

シーケンス内の指定したインデックス位置にある要素を返します。

ElementAt<TSource>(IEnumerable<TSource>, Int32)

シーケンス内の指定したインデックス位置にある要素を返します。

ElementAtOrDefault<TSource>(IEnumerable<TSource>, Index)

シーケンス内の指定したインデックス位置にある要素を返します。インデックスが範囲外の場合は既定値を返します。

ElementAtOrDefault<TSource>(IEnumerable<TSource>, Int32)

シーケンス内の指定したインデックス位置にある要素を返します。インデックスが範囲外の場合は既定値を返します。

Except<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)

既定の等値比較子を使用して値を比較することにより、2 つのシーケンスのセット差を生成します。

Except<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)

指定した IEqualityComparer<T> を使用して値を比較することにより、2 つのシーケンスのセット差を生成します。

ExceptBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TKey>, Func<TSource,TKey>)

指定されたキー セレクター関数に従って、2 つのシーケンスのセット差を生成します。

ExceptBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TKey>, Func<TSource,TKey>, IEqualityComparer<TKey>)

指定されたキー セレクター関数に従って、2 つのシーケンスのセット差を生成します。

First<TSource>(IEnumerable<TSource>)

シーケンスの最初の要素を返します。

First<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

指定した条件を満たすシーケンス内の最初の要素を返します。

FirstOrDefault<TSource>(IEnumerable<TSource>)

シーケンスの最初の要素を返します。シーケンスに要素が含まれている場合は既定値を返します。

FirstOrDefault<TSource>(IEnumerable<TSource>, TSource)

シーケンスの最初の要素を返します。シーケンスに要素が含まれている場合は、指定した既定値を返します。

FirstOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

条件を満たすシーケンスの最初の要素、またはそのような要素が見つからない場合は既定値を返します。

FirstOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>, TSource)

条件を満たすシーケンスの最初の要素を返します。そのような要素が見つからない場合は、指定した既定値を返します。

GroupBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

指定したキー セレクター関数に従ってシーケンスの要素をグループ化します。

GroupBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

指定したキー セレクター関数に従ってシーケンスの要素をグループ化し、指定した比較子を使用してキーを比較します。

GroupBy<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>)

指定したキー セレクター関数に従ってシーケンスの要素をグループ化し、指定した関数を使用して各グループの要素を投影します。

GroupBy<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

キー セレクター関数に従ってシーケンスの要素をグループ化します。 キーは比較子を使用して比較され、各グループの要素は指定された関数を使用して投影されます。

GroupBy<TSource,TKey,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>)

指定したキー セレクター関数に従ってシーケンスの要素をグループ化し、各グループとそのキーから結果値を作成します。

GroupBy<TSource,TKey,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TKey,IEnumerable<TSource>,TResult>, IEqualityComparer<TKey>)

指定したキー セレクター関数に従ってシーケンスの要素をグループ化し、各グループとそのキーから結果値を作成します。 キーは、指定された比較子を使用して比較されます。

GroupBy<TSource,TKey,TElement,TResult>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>,TResult>)

指定したキー セレクター関数に従ってシーケンスの要素をグループ化し、各グループとそのキーから結果値を作成します。 各グループの要素は、指定された関数を使用して投影されます。

GroupBy<TSource,TKey,TElement,TResult>(IEnumerable<TSource>, Func<TSource, TKey>, Func<TSource,TElement>, Func<TKey,IEnumerable<TElement>, TResult>, IEqualityComparer<TKey>)

指定したキー セレクター関数に従ってシーケンスの要素をグループ化し、各グループとそのキーから結果値を作成します。 キー値は指定された比較子を使用して比較され、各グループの要素は指定された関数を使用して投影されます。

GroupJoin<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,IEnumerable<TInner>, TResult>)

キーの等価性に基づいて 2 つのシーケンスの要素を関連付け、結果をグループ化します。 キーの比較には、既定の等値比較子が使用されます。

GroupJoin<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,IEnumerable<TInner>, TResult>, IEqualityComparer<TKey>)

キーの等価性に基づいて 2 つのシーケンスの要素を関連付け、結果をグループ化します。 キーの比較には、指定した IEqualityComparer<T> が使用されます。

Index<TSource>(IEnumerable<TSource>)

要素のインデックスをタプルに組み込む列挙可能な値を返します。

Intersect<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)

既定の等値比較子を使用して値を比較することにより、2 つのシーケンスの集合積集合を生成します。

Intersect<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)

指定した IEqualityComparer<T> を使用して値を比較することにより、2 つのシーケンスの集合積集合を生成します。

IntersectBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TKey>, Func<TSource,TKey>)

指定したキー セレクター関数に従って、2 つのシーケンスの集合積集合を生成します。

IntersectBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TKey>, Func<TSource,TKey>, IEqualityComparer<TKey>)

指定したキー セレクター関数に従って、2 つのシーケンスの集合積集合を生成します。

Join<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,TInner,TResult>)

一致するキーに基づいて、2 つのシーケンスの要素を関連付けます。 キーの比較には、既定の等値比較子が使用されます。

Join<TOuter,TInner,TKey,TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter,TKey>, Func<TInner,TKey>, Func<TOuter,TInner,TResult>, IEqualityComparer<TKey>)

一致するキーに基づいて、2 つのシーケンスの要素を関連付けます。 キーの比較には、指定した IEqualityComparer<T> が使用されます。

Last<TSource>(IEnumerable<TSource>)

シーケンスの最後の要素を返します。

Last<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

指定した条件を満たすシーケンスの最後の要素を返します。

LastOrDefault<TSource>(IEnumerable<TSource>)

シーケンスの最後の要素を返します。シーケンスに要素が含まれている場合は既定値を返します。

LastOrDefault<TSource>(IEnumerable<TSource>, TSource)

シーケンスの最後の要素を返します。シーケンスに要素が含まれている場合は、指定した既定値を返します。

LastOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

条件を満たすシーケンスの最後の要素、またはそのような要素が見つからない場合は既定値を返します。

LastOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>, TSource)

条件を満たすシーケンスの最後の要素を返します。そのような要素が見つからない場合は、指定された既定値を返します。

LongCount<TSource>(IEnumerable<TSource>)

シーケンス内の要素の合計数を表す Int64 を返します。

LongCount<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

条件を満たすシーケンス内の要素の数を表す Int64 を返します。

Max<TSource>(IEnumerable<TSource>)

ジェネリック シーケンスの最大値を返します。

Max<TSource>(IEnumerable<TSource>, IComparer<TSource>)

ジェネリック シーケンスの最大値を返します。

Max<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)

シーケンスの各要素に対して変換関数を呼び出し、最大 Decimal 値を返します。

Max<TSource>(IEnumerable<TSource>, Func<TSource,Double>)

シーケンスの各要素に対して変換関数を呼び出し、最大 Double 値を返します。

Max<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)

シーケンスの各要素に対して変換関数を呼び出し、最大 Int32 値を返します。

Max<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)

シーケンスの各要素に対して変換関数を呼び出し、最大 Int64 値を返します。

Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)

シーケンスの各要素に対して変換関数を呼び出し、null 許容の最大 Decimal 値を返します。

Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)

シーケンスの各要素に対して変換関数を呼び出し、null 許容の最大 Double 値を返します。

Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)

シーケンスの各要素に対して変換関数を呼び出し、null 許容の最大 Int32 値を返します。

Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)

シーケンスの各要素に対して変換関数を呼び出し、null 許容の最大 Int64 値を返します。

Max<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)

シーケンスの各要素に対して変換関数を呼び出し、null 許容の最大 Single 値を返します。

Max<TSource>(IEnumerable<TSource>, Func<TSource,Single>)

シーケンスの各要素に対して変換関数を呼び出し、最大 Single 値を返します。

Max<TSource,TResult>(IEnumerable<TSource>, Func<TSource,TResult>)

ジェネリック シーケンスの各要素に対して変換関数を呼び出し、結果の最大値を返します。

MaxBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

指定したキー セレクター関数に従って、ジェネリック シーケンスの最大値を返します。

MaxBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)

指定したキー セレクター関数とキー比較子に従って、ジェネリック シーケンスの最大値を返します。

Min<TSource>(IEnumerable<TSource>)

ジェネリック シーケンスの最小値を返します。

Min<TSource>(IEnumerable<TSource>, IComparer<TSource>)

ジェネリック シーケンスの最小値を返します。

Min<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)

シーケンスの各要素に対して変換関数を呼び出し、最小 Decimal 値を返します。

Min<TSource>(IEnumerable<TSource>, Func<TSource,Double>)

シーケンスの各要素に対して変換関数を呼び出し、最小 Double 値を返します。

Min<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)

シーケンスの各要素に対して変換関数を呼び出し、最小 Int32 値を返します。

Min<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)

シーケンスの各要素に対して変換関数を呼び出し、最小 Int64 値を返します。

Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)

シーケンスの各要素に対して変換関数を呼び出し、null 許容の最小 Decimal 値を返します。

Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)

シーケンスの各要素に対して変換関数を呼び出し、null 許容の最小 Double 値を返します。

Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)

シーケンスの各要素に対して変換関数を呼び出し、null 許容の最小 Int32 値を返します。

Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)

シーケンスの各要素に対して変換関数を呼び出し、null 許容の最小 Int64 値を返します。

Min<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)

シーケンスの各要素に対して変換関数を呼び出し、null 許容の最小 Single 値を返します。

Min<TSource>(IEnumerable<TSource>, Func<TSource,Single>)

シーケンスの各要素に対して変換関数を呼び出し、最小 Single 値を返します。

Min<TSource,TResult>(IEnumerable<TSource>, Func<TSource,TResult>)

ジェネリック シーケンスの各要素に対して変換関数を呼び出し、結果の最小値を返します。

MinBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

指定したキー セレクター関数に従って、ジェネリック シーケンスの最小値を返します。

MinBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)

指定したキー セレクター関数とキー比較子に従って、ジェネリック シーケンスの最小値を返します。

OfType<TResult>(IEnumerable)

指定した型に基づいて、IEnumerable の要素をフィルター処理します。

Order<T>(IEnumerable<T>)

シーケンスの要素を昇順で並べ替えます。

Order<T>(IEnumerable<T>, IComparer<T>)

シーケンスの要素を昇順で並べ替えます。

OrderBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

キーに従って、シーケンスの要素を昇順で並べ替えます。

OrderBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)

指定した比較子を使用して、シーケンスの要素を昇順で並べ替えます。

OrderByDescending<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

キーに従ってシーケンスの要素を降順に並べ替えます。

OrderByDescending<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)

指定した比較子を使用して、シーケンスの要素を降順で並べ替えます。

OrderDescending<T>(IEnumerable<T>)

シーケンスの要素を降順で並べ替えます。

OrderDescending<T>(IEnumerable<T>, IComparer<T>)

シーケンスの要素を降順で並べ替えます。

Prepend<TSource>(IEnumerable<TSource>, TSource)

シーケンスの先頭に値を追加します。

Reverse<TSource>(IEnumerable<TSource>)

シーケンス内の要素の順序を反転します。

Select<TSource,TResult>(IEnumerable<TSource>, Func<TSource,TResult>)

シーケンスの各要素を新しいフォームに投影します。

Select<TSource,TResult>(IEnumerable<TSource>, Func<TSource,Int32,TResult>)

要素のインデックスを組み込んで、シーケンスの各要素を新しいフォームに投影します。

SelectMany<TSource,TResult>(IEnumerable<TSource>, Func<TSource,IEnumerable<TResult>>)

シーケンスの各要素を IEnumerable<T> に投影し、結果のシーケンスを 1 つのシーケンスにフラット化します。

SelectMany<TSource,TResult>(IEnumerable<TSource>, Func<TSource,Int32,IEnumerable<TResult>>)

シーケンスの各要素を IEnumerable<T>に投影し、結果のシーケンスを 1 つのシーケンスにフラット化します。 各ソース要素のインデックスは、その要素の投影形式で使用されます。

SelectMany<TSource,TCollection,TResult>(IEnumerable<TSource>, Func<TSource,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)

シーケンスの各要素を IEnumerable<T>に投影し、結果のシーケンスを 1 つのシーケンスにフラット化し、その中の各要素に対して結果セレクター関数を呼び出します。

SelectMany<TSource,TCollection,TResult>(IEnumerable<TSource>, Func<TSource,Int32,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)

シーケンスの各要素を IEnumerable<T>に投影し、結果のシーケンスを 1 つのシーケンスにフラット化し、その中の各要素に対して結果セレクター関数を呼び出します。 各ソース要素のインデックスは、その要素の中間投影形式で使用されます。

SequenceEqual<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)

型の既定の等値比較子を使用して要素を比較することで、2 つのシーケンスが等しいかどうかを判断します。

SequenceEqual<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)

指定した IEqualityComparer<T>を使用して要素を比較して、2 つのシーケンスが等しいかどうかを判断します。

Single<TSource>(IEnumerable<TSource>)

シーケンスの唯一の要素を返し、シーケンス内に要素が 1 つだけ存在しない場合は例外をスローします。

Single<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

指定した条件を満たすシーケンスの唯一の要素を返し、そのような要素が複数存在する場合は例外をスローします。

SingleOrDefault<TSource>(IEnumerable<TSource>)

シーケンスの唯一の要素を返します。シーケンスが空の場合は既定値を返します。シーケンス内に複数の要素がある場合、このメソッドは例外をスローします。

SingleOrDefault<TSource>(IEnumerable<TSource>, TSource)

シーケンスの唯一の要素を返します。シーケンスが空の場合は、指定した既定値を返します。シーケンス内に複数の要素がある場合、このメソッドは例外をスローします。

SingleOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

指定した条件を満たすシーケンスの唯一の要素、またはそのような要素が存在しない場合は既定値を返します。このメソッドは、複数の要素が条件を満たす場合に例外をスローします。

SingleOrDefault<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>, TSource)

指定した条件を満たすシーケンスの唯一の要素、またはそのような要素が存在しない場合は指定された既定値を返します。このメソッドは、複数の要素が条件を満たす場合に例外をスローします。

Skip<TSource>(IEnumerable<TSource>, Int32)

シーケンス内の指定された数の要素をバイパスし、残りの要素を返します。

SkipLast<TSource>(IEnumerable<TSource>, Int32)

ソース コレクションの最後の count 要素を省略した source の要素を含む新しい列挙可能なコレクションを返します。

SkipWhile<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

指定した条件が true である限り、シーケンス内の要素をバイパスし、残りの要素を返します。

SkipWhile<TSource>(IEnumerable<TSource>, Func<TSource,Int32,Boolean>)

指定した条件が true である限り、シーケンス内の要素をバイパスし、残りの要素を返します。 要素のインデックスは、述語関数のロジックで使用されます。

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Decimal>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される Decimal 値のシーケンスの合計を計算します。

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Double>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される Double 値のシーケンスの合計を計算します。

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Int32>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される Int32 値のシーケンスの合計を計算します。

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Int64>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される Int64 値のシーケンスの合計を計算します。

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Decimal>>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される null 許容 Decimal 値のシーケンスの合計を計算します。

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Double>>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される null 許容 Double 値のシーケンスの合計を計算します。

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int32>>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される null 許容 Int32 値のシーケンスの合計を計算します。

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Int64>>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される null 許容 Int64 値のシーケンスの合計を計算します。

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Nullable<Single>>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される null 許容 Single 値のシーケンスの合計を計算します。

Sum<TSource>(IEnumerable<TSource>, Func<TSource,Single>)

入力シーケンスの各要素で変換関数を呼び出すことによって取得される Single 値のシーケンスの合計を計算します。

Take<TSource>(IEnumerable<TSource>, Int32)

シーケンスの先頭から指定した数の連続する要素を返します。

Take<TSource>(IEnumerable<TSource>, Range)

シーケンスから指定した連続する要素の範囲を返します。

TakeLast<TSource>(IEnumerable<TSource>, Int32)

sourceの最後の count 要素を含む新しい列挙可能なコレクションを返します。

TakeWhile<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

指定した条件が true である限り、シーケンスから要素を返します。

TakeWhile<TSource>(IEnumerable<TSource>, Func<TSource,Int32,Boolean>)

指定した条件が true である限り、シーケンスから要素を返します。 要素のインデックスは、述語関数のロジックで使用されます。

ToArray<TSource>(IEnumerable<TSource>)

IEnumerable<T>から配列を作成します。

ToDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

指定したキー セレクター関数に従って、IEnumerable<T> から Dictionary<TKey,TValue> を作成します。

ToDictionary<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

指定したキー セレクター関数とキー比較子に従って、IEnumerable<T> から Dictionary<TKey,TValue> を作成します。

ToDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>)

指定したキー セレクターおよび要素セレクター関数に従って、IEnumerable<T> から Dictionary<TKey,TValue> を作成します。

ToDictionary<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

指定したキー セレクター関数、比較子、および要素セレクター関数に従って、IEnumerable<T> から Dictionary<TKey,TValue> を作成します。

ToHashSet<TSource>(IEnumerable<TSource>)

IEnumerable<T>から HashSet<T> を作成します。

ToHashSet<TSource>(IEnumerable<TSource>, IEqualityComparer<TSource>)

キーを比較する comparer を使用して、IEnumerable<T> から HashSet<T> を作成します。

ToList<TSource>(IEnumerable<TSource>)

IEnumerable<T>から List<T> を作成します。

ToLookup<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

指定したキー セレクター関数に従って、IEnumerable<T> から Lookup<TKey,TElement> を作成します。

ToLookup<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

指定したキー セレクター関数とキー比較子に従って、IEnumerable<T> から Lookup<TKey,TElement> を作成します。

ToLookup<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>)

指定したキー セレクターおよび要素セレクター関数に従って、IEnumerable<T> から Lookup<TKey,TElement> を作成します。

ToLookup<TSource,TKey,TElement>(IEnumerable<TSource>, Func<TSource,TKey>, Func<TSource,TElement>, IEqualityComparer<TKey>)

指定したキー セレクター関数、比較子、および要素セレクター関数に従って、IEnumerable<T> から Lookup<TKey,TElement> を作成します。

TryGetNonEnumeratedCount<TSource>(IEnumerable<TSource>, Int32)

列挙を強制せずに、シーケンス内の要素の数を特定しようとします。

Union<TSource>(IEnumerable<TSource>, IEnumerable<TSource>)

既定の等値比較子を使用して、2 つのシーケンスのセット和集合を生成します。

Union<TSource>(IEnumerable<TSource>, IEnumerable<TSource>, IEqualityComparer<TSource>)

指定した IEqualityComparer<T>を使用して、2 つのシーケンスのセット和集合を生成します。

UnionBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TSource>, Func<TSource,TKey>)

指定したキー セレクター関数に従って、2 つのシーケンスのセット和集合を生成します。

UnionBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

指定したキー セレクター関数に従って、2 つのシーケンスのセット和集合を生成します。

Where<TSource>(IEnumerable<TSource>, Func<TSource,Boolean>)

述語に基づいて値のシーケンスをフィルター処理します。

Where<TSource>(IEnumerable<TSource>, Func<TSource,Int32,Boolean>)

述語に基づいて値のシーケンスをフィルター処理します。 各要素のインデックスは、述語関数のロジックで使用されます。

Zip<TFirst,TSecond>(IEnumerable<TFirst>, IEnumerable<TSecond>)

指定した 2 つのシーケンスの要素を含むタプルのシーケンスを生成します。

Zip<TFirst,TSecond,TThird>(IEnumerable<TFirst>, IEnumerable<TSecond>, IEnumerable<TThird>)

指定された 3 つのシーケンスの要素を持つタプルのシーケンスを生成します。

Zip<TFirst,TSecond,TResult>(IEnumerable<TFirst>, IEnumerable<TSecond>, Func<TFirst,TSecond,TResult>)

指定した関数を 2 つのシーケンスの対応する要素に適用し、結果のシーケンスを生成します。

AsParallel(IEnumerable)

クエリの並列化を有効にします。

AsParallel<TSource>(IEnumerable<TSource>)

クエリの並列化を有効にします。

AsQueryable(IEnumerable)

IEnumerableIQueryableに変換します。

AsQueryable<TElement>(IEnumerable<TElement>)

ジェネリック IEnumerable<T> をジェネリック IQueryable<T>に変換します。

Ancestors<T>(IEnumerable<T>)

ソース コレクション内のすべてのノードの先祖を含む要素のコレクションを返します。

Ancestors<T>(IEnumerable<T>, XName)

ソース コレクション内のすべてのノードの先祖を含む要素のフィルター処理されたコレクションを返します。 コレクションには、一致する XName を持つ要素のみが含まれます。

DescendantNodes<T>(IEnumerable<T>)

ソース コレクション内のすべてのドキュメントと要素の子孫ノードのコレクションを返します。

Descendants<T>(IEnumerable<T>)

ソース コレクション内のすべての要素とドキュメントの子孫要素を含む要素のコレクションを返します。

Descendants<T>(IEnumerable<T>, XName)

ソース コレクション内のすべての要素とドキュメントの子孫要素を含む要素のフィルター処理されたコレクションを返します。 コレクションには、一致する XName を持つ要素のみが含まれます。

Elements<T>(IEnumerable<T>)

ソース コレクション内のすべての要素とドキュメントの子要素のコレクションを返します。

Elements<T>(IEnumerable<T>, XName)

ソース コレクション内のすべての要素とドキュメントの子要素のフィルター処理されたコレクションを返します。 コレクションには、一致する XName を持つ要素のみが含まれます。

InDocumentOrder<T>(IEnumerable<T>)

ドキュメントの順序で並べ替えられた、ソース コレクション内のすべてのノードを含むノードのコレクションを返します。

Nodes<T>(IEnumerable<T>)

ソース コレクション内のすべてのドキュメントおよび要素の子ノードのコレクションを返します。

Remove<T>(IEnumerable<T>)

ソース コレクション内のすべてのノードを親ノードから削除します。

適用対象

スレッド セーフ

Dispose メソッドはスレッド セーフではありません。 BlockingCollection<T> の他のすべてのパブリック メンバーと保護されたメンバーはスレッド セーフであり、複数のスレッドから同時に使用できます。

こちらもご覧ください