ObservableObjectBaseGetT Method (T, String)

KGy SOFT Core Libraries Help
Gets the value of a property or defaultValue if no value is stored for it. No new value will be stored if the property does not exist. If the default initial value is too complex and should not be evaluated every time when the property is get, or to throw an exception for an uninitialized property use the other Get overload.
For an example, see the Remarks section of the ObservableObjectBase class.

Namespace:  KGySoft.ComponentModel
Assembly:  KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 5.4.0

protected T Get<T>(
	T defaultValue = null,
	string propertyName = null


defaultValue (Optional)
Type: T
The value to return if property does not exist. This parameter is optional.
Default value: The default value of T type.
propertyName (Optional)
Type: SystemString
The name of the property to get. This parameter is optional.
Default value: The name of the caller member.

Type Parameters

The type of the property.

Return Value

Type: T
The value of the property, or the specified defaultValue.

ArgumentNullExceptionpropertyName is .
InvalidOperationExceptionpropertyName cannot be retrieved.
CanGetProperty is not overridden and propertyName is not an actual instance property in this instance.
See Also