Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Latest commit

 

History

History
114 lines (73 loc) · 2.77 KB

CollectionDescriptor.md

File metadata and controls

114 lines (73 loc) · 2.77 KB

ApplyMaxLengthAttribute.CollectionDescriptor ..

Used to describe how collections should be mutated.

Namespace: Dado.ComponentModel.DataMutations

Syntax

public sealed class CollectionDescriptor

Remarks

This class will likely be obsolete once generics or lambdas are implemented for System.Attributes.

Properties

Name Description
CollectionMutator Gets a function accepting a length and collection which returns a collection.

Methods

Name Description
SetCollectionMutator<T>(Func<Int32, T, T>) Sets the CollectionMutator for an ICollection.
SetGenericCollectionMutator<T>(Func<Int32, ICollection<T>, ICollection<T>>) Sets the CollectionMutator for a generic ICollection<T>.

CollectionMutator

Gets a function accepting a length and collection which returns a collection.

Syntax

public Func<int, IEnumerable, IEnumerable> CollectionMutator { get; private set; }
Type
System.Func<Int32, IEnumerable, IEnumerable>

SetCollectionMutator<T>(Func<Int32, T, T>)

Sets the CollectionMutator for an ICollection.

Syntax

public CollectionDescriptor SetCollectionMutator<T>(
	Func<int, T, T> mutator
)
	where T : ICollection
T
The type of that describes an ICollection.

Returns

Returns this instance of the CollectionDescriptor.

Parameters

mutator
Type: System.Func<System.Int32, `T, `T>
The function accepting a length and collection which returns a collection.

SetGenericCollectionMutator<T>(Func<Int32, ICollection<T>, ICollection<T>>)

Sets the CollectionMutator for a generic ICollection<T>.

Syntax

public CollectionDescriptor SetGenericCollectionMutator<T>(
	Func<int, ICollection<T>, ICollection<T>> mutator
)
T
The type of the elements in the collection.

Returns

Returns this instance of the CollectionDescriptor.

Parameters

mutator
Type: System.Func<System.Int32, System.Collections.Generic.ICollection<`T>, System.Collections.Generic.ICollection<`T>>
The function accepting a length and collection which returns a collection.

See Also

dotnet/csharplang#124
dotnet/csharplang#343