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
'Declaração
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.
- creator
Type: System.Func<TResult>
The delegate used to create the property (if needed).
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.