本文整理汇总了C#中System.Web.SiteMapNodeCollection.IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# SiteMapNodeCollection.IndexOf方法的具体用法?C# SiteMapNodeCollection.IndexOf怎么用?C# SiteMapNodeCollection.IndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.SiteMapNodeCollection
的用法示例。
在下文中一共展示了SiteMapNodeCollection.IndexOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: if
String providername1 = "AspNetXmlSiteMapProvider";
String providername2 = "MyXmlSiteMapProvider";
SiteMapProviderCollection providers = SiteMap.Providers;
if (providers[providername1] != null && providers[providername2] != null)
{
SiteMapProvider provider1 = providers[providername1];
SiteMapProvider provider2 = providers[providername2];
SiteMapNodeCollection collection1 = provider1.RootNode.ChildNodes;
SiteMapNodeCollection collection2 = provider2.RootNode.ChildNodes;
int matches = 0;
foreach (SiteMapNode node in collection1)
{
if (collection2.Contains(node))
{
Response.Write("Match found at " +
providername1 + ", index = " +
collection1.IndexOf(node) + " with " +
providername2 + ", index = " +
collection2.IndexOf(node) + ".<br />");
matches++;
}
}
Response.Write("Number of matches found = " +
matches.ToString() + ".");
}
else
{
Response.Write(providername1 + " or " +
providername2 + " not found.");
}