PropertyCollection.GetOrCreateSingletonProperty<T> Method (Object, Func)

Gets or creates a property of typeT from the property collection.

Namespace: Microsoft.VisualStudio.Utilities
Assembly: Microsoft.VisualStudio.CoreUtility (in Microsoft.VisualStudio.CoreUtility.dll)

Syntax

'Dichiarazione
Public Function GetOrCreateSingletonProperty(Of T As Class) ( _
    key As Object, _
    creator As Func _
) As T
public T GetOrCreateSingletonProperty<T>(
    Object key,
    Func creator
)
where T : class
public:
generic<typename T>
where T : ref class
T GetOrCreateSingletonProperty(
    Object^ key, 
    Func^ creator
)
member GetOrCreateSingletonProperty : 
        key:Object * 
        creator:Func -> 'T  when 'T : not struct
JScript does not support generic types or methods.

Type Parameters

  • T
    The type of the property.

Parameters

  • key
    Type: System.Object
    The key of the property to get or create.

Return Value

Type: T
The property that was requested. If there is already a property with the specified key, returns the existing property. Otherwise, this method uses creator to create an instance of that type and add it to the collection with the specified key.

.NET Framework Security

See Also

Reference

PropertyCollection Class

GetOrCreateSingletonProperty Overload

Microsoft.VisualStudio.Utilities Namespace