Represents a list of subitems of an item.
For a list of all members of this type, see ChildList Members.
System.Object
Sitecore.Collections.ChildList
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
[Item Defined]]
An item can be retrieved by its ID, name or index in the collection.
The position of an item in the collection can be determined by using the IndexOf method.
To sort the collection like the Sitecore client, use the Sort method.
The collection can be converted to an array using the ToArray method.
This example gets the names of the subitems that has the Document template.
public string GetDocumentNames() {
string result = "";
Item item = Sitecore.Context.Database.Items["/sitecore/content/Home"];
foreach(Item child in item.Children) {
if (child.Template.Name == "Document") {
result += child.Name + ",";
}
}
return result;
}
Namespace: Sitecore.Collections
Assembly: Sitecore.Kernel (in Sitecore.Kernel.dll)
ChildList Members | Sitecore.Collections Namespace