Class ContentItemData
- Namespace
- CMS.ContentEngine
- Assembly
- CMS.ContentEngine.dll
Storage for type specific content item data, used by IContentItemManager.
public sealed class ContentItemData
- Inheritance
-
objectContentItemData
- Extension Methods
Constructors
ContentItemData()
Creates a new empty instance of ContentItemData.
public ContentItemData()
ContentItemData(IEnumerable<KeyValuePair<string, object>>)
Initializes a new instance of the ContentItemData with the specified initial data.
public ContentItemData(IEnumerable<KeyValuePair<string, object>> initialData)
Parameters
initialData
IEnumerable<KeyValuePair<string, object>>A collection containing the initial data for the content item.
Remarks
Exception could be thrown if initialData
uses different string equality comparer than System.StringComparer.InvariantCultureIgnoreCase.
Methods
SetValue<T>(string, T)
Adds or updates value of given key in content item data.
public void SetValue<T>(string key, T value)
Parameters
key
stringKey to store the value under.
value
TValue to store.
Type Parameters
T
Exceptions
- ArgumentNullException
Thrown if
key
is null.
TryGetValue<T>(string, out T)
Tries to get value of given key from content item data.
public bool TryGetValue<T>(string key, out T value)
Parameters
key
stringKey of stored value.
value
TValue stored under given key.
Returns
- bool
True if the key is in content item data, false otherwise.
Type Parameters
T
Exceptions
- ArgumentNullException
Thrown if
key
is null.- InvalidCastException
Thrown if type of value stored in data cannot be cast to the type of
value
.