Show / Hide Table of Contents

Struct InvocationList<TDelegate>

Represents immutable list of delegates.

Implements
IReadOnlyList<TDelegate>
IReadOnlyCollection<TDelegate>
IEnumerable<TDelegate>
IEnumerable
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
ValueType.ToString()
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: DotNext.Collections.Specialized
Assembly: DotNext.dll
Syntax
public readonly struct InvocationList<TDelegate> : IReadOnlyList<TDelegate>, IReadOnlyCollection<TDelegate>, IEnumerable<TDelegate>, IEnumerable where TDelegate : MulticastDelegate
Type Parameters
Name Description
TDelegate

The type of delegates in the list.

Remarks

This type can be used to store a list of event handlers in situations when the delegate type allows variance. In this case, Combine(params Delegate[]) may not be applicable due to lack of variance support.

Constructors

| Edit this page View Source

InvocationList(TDelegate)

Creates a new list containing a single element.

Declaration
public InvocationList(TDelegate d)
Parameters
Type Name Description
TDelegate d

The delegate to add.

Properties

| Edit this page View Source

Count

Gets the number of delegates in this list.

Declaration
public int Count { get; }
Property Value
Type Description
int
| Edit this page View Source

Empty

Gets an empty list.

Declaration
public static InvocationList<TDelegate> Empty { get; }
Property Value
Type Description
InvocationList<TDelegate>
| Edit this page View Source

IsEmpty

Indicates that this list is empty.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
bool
| Edit this page View Source

this[int]

Gets the element at the specified index in the read-only list.

Declaration
public TDelegate this[int index] { get; }
Parameters
Type Name Description
int index

The zero-based index of the element to get.

Property Value
Type Description
TDelegate

The element at the specified index in the read-only list.

| Edit this page View Source

Span

Gets a span over list of delegates.

Declaration
public ReadOnlySpan<TDelegate> Span { get; }
Property Value
Type Description
ReadOnlySpan<TDelegate>

Methods

| Edit this page View Source

Add(TDelegate?)

Adds a delegate to the list and return a new list.

Declaration
public InvocationList<TDelegate> Add(TDelegate? d)
Parameters
Type Name Description
TDelegate d

The delegate to add.

Returns
Type Description
InvocationList<TDelegate>

The modified list of delegates.

| Edit this page View Source

Combine()

Combines the delegates in the list to a single delegate.

Declaration
public TDelegate? Combine()
Returns
Type Description
TDelegate

A list of delegates combined as a single delegate.

| Edit this page View Source

GetEnumerator()

Gets enumerator over all delegates in this list.

Declaration
public InvocationList<TDelegate>.Enumerator GetEnumerator()
Returns
Type Description
InvocationList<TDelegate>.Enumerator

The enumerator over delegates.

| Edit this page View Source

Remove(TDelegate?)

Removes the delegate from the list.

Declaration
public InvocationList<TDelegate> Remove(TDelegate? d)
Parameters
Type Name Description
TDelegate d

The delegate to remove.

Returns
Type Description
InvocationList<TDelegate>

The modified list of delegates.

Operators

| Edit this page View Source

operator +(InvocationList<TDelegate>, TDelegate?)

Addes the delegate to the list and returns modified list.

Declaration
public static InvocationList<TDelegate> operator +(InvocationList<TDelegate> list, TDelegate? d)
Parameters
Type Name Description
InvocationList<TDelegate> list

The list of delegates.

TDelegate d

The delegate to add.

Returns
Type Description
InvocationList<TDelegate>

The modified list of delegates.

| Edit this page View Source

operator -(InvocationList<TDelegate>, TDelegate?)

Removes the delegate from the list and returns modified list.

Declaration
public static InvocationList<TDelegate> operator -(InvocationList<TDelegate> list, TDelegate? d)
Parameters
Type Name Description
InvocationList<TDelegate> list

The list of delegates.

TDelegate d

The delegate to remove.

Returns
Type Description
InvocationList<TDelegate>

The modified list of delegates.

Implements

IReadOnlyList<T>
IReadOnlyCollection<T>
IEnumerable<T>
IEnumerable

Extension Methods

BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
Collection.ToAsyncEnumerator<TEnumerator, T>(TEnumerator, CancellationToken)
Collection.ToClassicEnumerator<TEnumerator, T>(TEnumerator)
Enumerator.Skip<TEnumerator, T>(ref TEnumerator, int)
ExpressionBuilder.Const<T>(T)
Collection.Append<T>(IEnumerable<T>, params T[])
Collection.Copy<T>(IEnumerable<T>, int, MemoryAllocator<T>?)
Collection.ElementAt<T>(IEnumerable<T>, int, out T)
Collection.FirstOrNone<T>(IEnumerable<T>)
Collection.ForEachAsync<T>(IEnumerable<T>, Func<T, CancellationToken, ValueTask>, CancellationToken)
Collection.ForEach<T>(IEnumerable<T>, Action<T>)
Collection.LastOrNone<T>(IEnumerable<T>)
Collection.Prepend<T>(IEnumerable<T>, params T[])
Collection.SequenceHashCode<T>(IEnumerable<T>, bool)
Collection.SkipNulls<T>(IEnumerable<T?>)
Collection.ToAsyncEnumerable<T>(IEnumerable<T>)
Collection.ToString<T>(IEnumerable<T>, string, string)
Enumerator.GetAsyncEnumerator<T>(IEnumerable<T>, CancellationToken)
Collection.Convert<TInput, TOutput>(IReadOnlyCollection<TInput>, Converter<TInput, TOutput>)
List.Convert<TInput, TOutput>(IReadOnlyList<TInput>, Converter<TInput, TOutput>)
List.IndexerGetter<T>(IReadOnlyList<T>)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾