PropertyCollection.GetOrCreateSingletonProperty<T> Method (Func)
Gets or creates a property of type T from the property collection.
Namespace: Microsoft.VisualStudio.Utilities
Assembly: Microsoft.VisualStudio.CoreUtility (in Microsoft.VisualStudio.CoreUtility.dll)
Syntax
'Declaration
Public Function GetOrCreateSingletonProperty(Of T As Class) ( _
creator As Func _
) As T
public T GetOrCreateSingletonProperty<T>(
Func creator
)
where T : class
public:
generic<typename T>
where T : ref class
T GetOrCreateSingletonProperty(
Func^ creator
)
member GetOrCreateSingletonProperty :
creator:Func -> 'T when 'T : not struct
JScript does not support generic types or methods.
Type Parameters
- T
The type of the property.
Parameters
- creator
Type: System.Func<TResult>
The delegate used to create the property (if needed).
Return Value
Type: T
An instance of the property. If there is already a property of that type, it returns the existing property. Otherwise, this method uses creator to create an instance of that type.
Remarks
The key used in the property collection is the type of T.
.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.