如何获得一系列Sitecore兄弟项目?

Sac*_* R. 2 asp.net sitecore sitecore6

我想获得当前项目的所有兄弟项目的数组,以便我可以在其中显示缩略图.我该怎么做到这一点?

提前致谢.

Mar*_*lak 6

您可以获取当前项目的父项目,然后从当前项目中获取其所有子项目.

您可以使用以下代码:

Item currentItem = Sitecore.Context.Item;
Item[] siblings = currentItem.Parent.GetChildren().Where(c => c.ID != currentItem.ID).ToArray();
Run Code Online (Sandbox Code Playgroud)