Share via


Collection<T>.ApplyOnFirstAccess<C> Method

Applies the specified action on each element of the specified collection the first time the element is accessed.

Namespace:  Microsoft.SqlServer.Management.SqlParser.MetadataProvider
Assembly:  Microsoft.SqlServer.Management.SqlParser (in Microsoft.SqlServer.Management.SqlParser.dll)

Syntax

'Declaration
Public Shared Function ApplyOnFirstAccess(Of C As {Class, T}) ( _
    collection As IMutableMetadataCollection(Of C), _
    action As Action(Of C), _
    actionCompleted As Predicate(Of C) _
) As IMetadataCollection(Of T)
'Usage
Dim collection As IMutableMetadataCollection(Of C)
Dim action As Action(Of C)
Dim actionCompleted As Predicate(Of C)
Dim returnValue As IMetadataCollection(Of T)

returnValue = Collection.ApplyOnFirstAccess(collection, _
    action, actionCompleted)
public static IMetadataCollection<T> ApplyOnFirstAccess<C>(
    IMutableMetadataCollection<C> collection,
    Action<C> action,
    Predicate<C> actionCompleted
)
where C : class, T
public:
generic<typename C>
where C : ref class, T
static IMetadataCollection<T>^ ApplyOnFirstAccess(
    IMutableMetadataCollection<C>^ collection, 
    Action<C>^ action, 
    Predicate<C>^ actionCompleted
)
static member ApplyOnFirstAccess : 
        collection:IMutableMetadataCollection<'C> * 
        action:Action<'C> * 
        actionCompleted:Predicate<'C> -> IMetadataCollection<'T>  when 'C : not struct and 'T
JScript does not support generic types and methods.

Type Parameters

  • C
    The type of the action.

Parameters

  • action
    Type: System.Action<C>
    The action to perform on each element in the collection.
  • actionCompleted
    Type: System.Predicate<C>
    A predicate that indicates whether the performed action is completed.

Return Value

Type: Microsoft.SqlServer.Management.SqlParser.Metadata.IMetadataCollection<T>
A wrapper collection that applies an action on each element when it is accessed for the first time.