本文整理匯總了C#中SiliconStudio.Core.IO.UFile.GetParent方法的典型用法代碼示例。如果您正苦於以下問題:C# UFile.GetParent方法的具體用法?C# UFile.GetParent怎麽用?C# UFile.GetParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SiliconStudio.Core.IO.UFile
的用法示例。
在下文中一共展示了UFile.GetParent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestUPathGetParent
public void TestUPathGetParent()
{
// First directories
var dir = new UDirectory("c:/");
Assert.AreEqual("c:/", dir.GetParent().FullPath);
dir = new UDirectory("c:/a");
Assert.AreEqual("c:/", dir.GetParent().FullPath);
dir = new UDirectory("c:/a/b");
Assert.AreEqual("c:/a", dir.GetParent().FullPath);
dir = new UDirectory("/");
Assert.AreEqual("/", dir.GetParent().FullPath);
dir = new UDirectory("/a");
Assert.AreEqual("/", dir.GetParent().FullPath);
dir = new UDirectory("/a/b");
Assert.AreEqual("/a", dir.GetParent().FullPath);
dir = new UDirectory("a");
Assert.AreEqual("", dir.GetParent().FullPath);
dir = new UDirectory("a/b");
Assert.AreEqual("a", dir.GetParent().FullPath);
// Now with files.
var file = new UFile("c:/a.txt");
Assert.AreEqual("c:/", file.GetParent().FullPath);
file = new UFile("c:/a/b.txt");
Assert.AreEqual("c:/a", file.GetParent().FullPath);
file = new UFile("/a.txt");
Assert.AreEqual("/", file.GetParent().FullPath);
file = new UFile("/a/b.txt");
Assert.AreEqual("/a", file.GetParent().FullPath);
file = new UFile("a.txt");
Assert.AreEqual("", file.GetParent().FullPath);
file = new UFile("a/b.txt");
Assert.AreEqual("a", file.GetParent().FullPath);
}