What is the difference between kids and GetChildren at Sitecore? (V8.1)

So, while looking at the Sitecore code, I notice several ways to get children out of Item.

// Summary:
//     Gets the children.
public ChildList GetChildren();

and

// Summary:
//     Gets a list of child items.
public ChildList Children { get; }

Any thoughts on the differences between the two?

Also do not confuse with the overloaded method:

GetChildren(ChildListOptions options)
+4
source share
2 answers

Item.GetChildren () allows you to change the parameters. This flexibility is why .GetChildren () is preferred. Children to retrieve a collection of ChildList children.

For example, to ignore any protection applied to these elements, use: item.GetChildren (Sitecore.Collections.ChildListOptions.IgnoreSecurity)

Above is the code of these three methods / property

public ChildList GetChildren()
{
  return this.GetChildren(ChildListOptions.None);
}

public ChildList GetChildren(ChildListOptions options)
{
  return Sitecore.Diagnostics.Assert.ResultNotNull<ChildList>(ItemManager.GetChildren(this, (options & ChildListOptions.IgnoreSecurity) != ChildListOptions.None ? SecurityCheck.Disable : SecurityCheck.Enable, options));
}

public ChildList Children
{
  get
  {
    return new ChildList(this);
  }
}
+4
source

ItemManager.GetChildren(); ChildListOptions.None.

ChildList .

+2

All Articles