本文整理汇总了C#中Tree.Under方法的典型用法代码示例。如果您正苦于以下问题:C# Tree.Under方法的具体用法?C# Tree.Under怎么用?C# Tree.Under使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree.Under方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckCaseSensitiveSentence
public void CheckCaseSensitiveSentence()
{
var tree = new Tree<bool>(new char[] { ' ', ',', '.' }, StringComparer.Ordinal);
tree.Add("The quick brown fox jumps.", true);
Assert.IsTrue(tree.Under("The quick brown fox jumps over the lazy dog."));
Assert.IsFalse(tree.Under("THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG."));
Assert.IsFalse(tree.Under("A different sentence."));
}
示例2: CheckUnderDirectoriesWithWildcard
public void CheckUnderDirectoriesWithWildcard()
{
var tree = new Tree<bool>();
tree.Add(@"C:\X", true);
tree.Add(@"C:\X\*", false);
Assert.IsTrue(tree.Under(@"C:\X"));
Assert.IsFalse(tree.Under(@"C:\X\foo"));
Assert.IsFalse(tree.Under(@"C:\X\1\foo"));
Assert.IsFalse(tree.Under(@"D:\foo"));
}
示例3: CheckUnderDirectories
public void CheckUnderDirectories()
{
var tree = new Tree<bool>();
tree.Add(@"C:\A\1", true);
tree.Add(@"C:\A\2", true);
tree.Add(@"C:\B", true);
tree.Add(@"C:\B\1", false);
Assert.IsTrue(tree.Under(@"C:\A\1\foo"));
Assert.IsTrue(tree.Under(@"C:\B\2\foo"));
Assert.IsTrue(tree.Under(@"C:\B"));
Assert.IsFalse(tree.Under(@"C:\B\1\foo"));
Assert.IsFalse(tree.Under(@"C:\C\foo"));
Assert.IsFalse(tree.Under(@"D:\foo"));
}
示例4: NullKeyUnderThrows
public void NullKeyUnderThrows()
{
var tree = new Tree<bool>();
tree.Add(@"C:\A", true);
tree.Under(null);
}