Represents a master.
For a list of all members of this type, see MasterItem Members.
System.Object
Sitecore.Data.Items.CustomItemBase
Sitecore.Data.Items.CustomItem
Sitecore.Data.Items.MasterItem
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
A master is an instance of a template much like an item. When an item is created from a master, the master is copied into the new item which receives all the field values from the master. A master may contain subitems that are created whenever an item is created from a master.
The AddTo method create a new item based on the master to another item.
This example creates a new item.
public Item AddItem(Item parent, string name) {
Item result = null;
MasterItem master = Sitecore.Context.Database.Masters["Document"];
if (master != null) {
result = parent.Add(name, master);
}
return result;
}
The following example retrieves the master item. This can also be done by using the Master property.
{{
public MasterItem GetMaster(Item item) {
MasterItem result = item.Database.Masters[item.MasterID];
return result;
}
}}
Namespace: Sitecore.Data.Items
Assembly: Sitecore.Kernel (in Sitecore.Kernel.dll)
MasterItem Members | Sitecore.Data.Items Namespace