PropertyCollection::GetOrCreateSingletonProperty<T> Method (Object^, Func<T>^)

 

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)

public:
generic<typename T>
where T : ref class
T GetOrCreateSingletonProperty(
	Object^ key,
	Func<T>^ creator
)

Parameters

key
Type: System::Object^

The key of the property to get or create.

creator
Type: System::Func<T>^

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.

Type Parameters

T

The type of the property.

Return to top
Show: