C# Extension Method - FileInfo - IsPathRooted

CSharp · Console

/Program.cs

// C# Extension Method
// Doc: https://csharp-extension.com/en/method/1002021/fileinfo-ispathrooted

// @nuget: Z.ExtensionMethods

using System;
					
public class Program
{
	public static void Main()
	{
		string FileName = "folder\\subfolder\\test.txt";
				
		// C# Extension Method: FileInfo - IsPathRooted
		if(FileName.ToFileInfo().IsPathRooted())
		{
			Console.WriteLine("Path is rooted.");
		}
		else
		{
			Console.WriteLine("Path is not rooted.");
		}
	}
}
;