Class Settable<T>
Represents a value that can be assigned a value.
Inheritance
Namespace: Umbraco.Cms.Core
Assembly: Umbraco.Core.dll
Syntax
public class Settable<T>Type Parameters
| Name | Description | 
|---|---|
| T | The type of the value | 
Properties
View SourceHasValue
Gets a value indicating whether a value has been assigned to this Settable<T> instance.
Declaration
public bool HasValue { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Value
Gets the value assigned to this Settable<T> instance.
Declaration
public T Value { get; }Property Value
| Type | Description | 
|---|---|
| T | 
Remarks
An exception is thrown if the HasValue property is false.
Methods
View SourceClear()
Clears the value.
Declaration
public void Clear()Set(T)
Assigns a value to this Settable<T> instance.
Declaration
public void Set(T value)Parameters
| Type | Name | Description | 
|---|---|---|
| T | value | The value. | 
Set(Settable<T>)
Assigns a value to this Settable<T> instance by copying the value of another instance, if the other instance has a value.
Declaration
public void Set(Settable<T> other)Parameters
| Type | Name | Description | 
|---|---|---|
| Settable<T> | other | The other instance. | 
ToString()
Declaration
public override string ToString()Returns
| Type | Description | 
|---|---|
| System.String | 
ValueOrDefault()
Gets the value assigned to this Settable<T> instance, if a value has been assigned,
otherwise the default value of T.
Declaration
public T ValueOrDefault()Returns
| Type | Description | 
|---|---|
| T | The value assigned to this Settable<T> instance, if a value has been assigned,
else the default value of  | 
ValueOrDefault(T)
Gets the value assigned to this Settable<T> instance, if a value has been assigned, otherwise a specified default value.
Declaration
public T ValueOrDefault(T defaultValue)Parameters
| Type | Name | Description | 
|---|---|---|
| T | defaultValue | The default value. | 
Returns
| Type | Description | 
|---|---|
| T | The value assigned to this Settable<T> instance, if a value has been assigned,
else  |