C# Program to Demonstrate the Use of FullName Property
DirectoryInfo class provides different types of methods and properties that are used to perform operations on directories and sub-directories like creating, moving, etc and FullName property is one of them. This property is used to find the full path of the directory or the specified file.
Syntax:
public virtual string FullName { get; }
Return: It will return a string that contains the full path of the current directory or file.
Exception: This property will throw the following exceptions:
- PathTooLongException: This exception will occur when the path and the file name exceed the system-defined maximum length.
- SecurityException: This exception will occur when the caller doesn’t have enough permissions.
Example:
C#
using System;
using System.IO;
class GFG{
static void Main()
{
DirectoryInfo full_name = new DirectoryInfo( "vignan" );
Console.WriteLine( "FullName" );
Console.WriteLine(full_name.FullName);
}
}
|
Output:
FullName
/home/cg/root/8057718/vignan
Last Updated :
01 Feb, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...