Class PropertyTypeCollection
Represents a collection of IPropertyType objects.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
Syntax
[DataContract]
public class PropertyTypeCollection : KeyedCollection<string, IPropertyType>, IDeepCloneable
Constructors
View SourcePropertyTypeCollection(bool)
Initializes a new instance of the PropertyTypeCollection class.
Declaration
public PropertyTypeCollection(bool supportsPublishing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | supportsPublishing | A value indicating whether the property types in this collection support publishing. |
PropertyTypeCollection(bool, IEnumerable<IPropertyType>)
Initializes a new instance of the PropertyTypeCollection class with initial property types.
Declaration
public PropertyTypeCollection(bool supportsPublishing, IEnumerable<IPropertyType> properties)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | supportsPublishing | A value indicating whether the property types in this collection support publishing. |
| IEnumerable<IPropertyType> | properties | The initial property types to add to the collection. |
Properties
View SourceIsReadOnly
Declaration
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| bool |
SupportsPublishing
Gets a value indicating whether the property types in this collection support publishing.
Declaration
public bool SupportsPublishing { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceAdd(IPropertyType)
Adds a property type to the collection.
Declaration
public void Add(IPropertyType item)
Parameters
| Type | Name | Description |
|---|---|---|
| IPropertyType | item | The property type to add. |
Remarks
The 'new' keyword is required because we can explicitly implement System.Collections.Generic.ICollection<T>.Add(T), but since normally a concrete PropertyType type is passed in, the explicit implementation doesn't get called. This ensures it does get called.
ClearCollectionChangedEvents()
Clears all CollectionChanged event handlers
Declaration
public void ClearCollectionChangedEvents()
ClearItems()
Declaration
protected override void ClearItems()
Contains(string)
Determines whether this collection contains a Property whose alias matches the specified PropertyType.
Declaration
public bool Contains(string propertyAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyAlias | Alias of the PropertyType. |
Returns
| Type | Description |
|---|---|
| bool |
|
DeepClone()
Creates a deep clone of the current object.
Declaration
public object DeepClone()
Returns
| Type | Description |
|---|---|
| object | A deep clone of the current object. |
GetKeyForItem(IPropertyType)
Declaration
protected override string GetKeyForItem(IPropertyType item)
Parameters
| Type | Name | Description |
|---|---|---|
| IPropertyType | item |
Returns
| Type | Description |
|---|---|
| string |
IndexOfKey(string)
Gets the index of the property type with the specified alias.
Declaration
public int IndexOfKey(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The alias to search for. |
Returns
| Type | Description |
|---|---|
| int | The zero-based index of the property type, or -1 if not found. |
InsertItem(int, IPropertyType)
Declaration
protected override void InsertItem(int index, IPropertyType item)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | |
| IPropertyType | item |
OnCollectionChanged(NotifyCollectionChangedEventArgs)
Raises the CollectionChanged event.
Declaration
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| NotifyCollectionChangedEventArgs | args | The event arguments. |
RemoveItem(int)
Declaration
protected override void RemoveItem(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |
RemoveItem(string)
Removes the property type with the specified alias from the collection.
Declaration
public bool RemoveItem(string propertyTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyTypeAlias | The alias of the property type to remove. |
Returns
| Type | Description |
|---|---|
| bool |
|
SetItem(int, IPropertyType)
Declaration
protected override void SetItem(int index, IPropertyType item)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | |
| IPropertyType | item |
Events
View SourceCollectionChanged
Declaration
public event NotifyCollectionChangedEventHandler? CollectionChanged
Event Type
| Type | Description |
|---|---|
| NotifyCollectionChangedEventHandler |