C# Program to Show the Use of Exists Property Last Updated : 26 Jan, 2022 Comments Improve Suggest changes Like Article Like Report DirectoryInfo class provides different types of methods and properties for creating, moving, deleting, renaming, and modifying directories and subdirectories. Exists property is the property of DirectoryInfo class. This property is used to check whether a directory exists or not and return the boolean value accordingly. It will return true if the directory exists, otherwise, it will return false. It will also return if any error occurs while determining if the file exists, or if the specified file is missing, or if the caller does not get permission to read the specified file. Syntax: bool DirectoryInfo.Exists Example: C# // C# program to understande the use of Exists Property using System; using System.IO; class GFG{ static void Main() { // Getting the directory information DirectoryInfo information = new DirectoryInfo("sravan_directory"); // Checking whether the given directory // exists or not // Using Exists property if (information.Exists) Console.WriteLine("Exists"); else Console.WriteLine("Not Exists"); } } Output: Not Exists Comment More infoAdvertise with us Next Article C# Program to Show the Use of Exists Property sravankumar_171fa07058 Follow Improve Article Tags : C# C# Programs Similar Reads C# Program to Demonstrate the Use of CanSeek Property FileStream class is used to perform read and write operations in a file. It provides full support for both synchronous and asynchronous read and write operations. This class provides different types of methods and properties and the CanSeek property is one of them. This property is used to find a va 2 min read C# Program to Check a Specified Type is a Pointer or not A pointer is a variable that contains the references of another variable. Or in other words, the pointer is a variable that stores the address of the same type of variable. For example, a string pointer can store the address of a string. In C#, we can able to check the given type is a pointer or not 2 min read C# Program to Check Given Directory Exists or not Given a directory, now our task is to check given directory exists or not. So to this task, we use the Exists() method of the Directory class. This method will return true if the given directory exists, otherwise false. Syntax: public static bool Exists (string? Mypath); Where, Mypath is a parameter 2 min read C Program to Show Unreachable Code Error Here, we will see how to show unreachable code errors using the C program. Unreachable statements are statements that will not be executed during the program execution. These statements may be unreachable due to the following reasons: Return statement before print statement.Infinite loop before stat 3 min read C Program to Compare Two Strings Using Pointers In C, two strings are generally compared character by character in lexicographical order (alphabetical order). In this article, we will learn how to compare two strings using pointers.To compare two strings using pointers, increment the pointers to traverse through each character of the strings whil 2 min read How to Run C program in Ubuntu Learning to run a C program in Ubuntu is a great first step for anyone starting their programming journey or switching to a Linux-based system. Ubuntu offers a clean and powerful environment to write, compile, and execute C code all from the terminal.In C, this guide will show you how to get started 4 min read PL/SQL EXISTS Operator The EXISTS operator in PL/SQL is a powerful tool used to check the existence of records in a subquery. Unlike traditional comparison operators that evaluate data values, EXISTS focuses on whether a set of conditions returns any rows. It is commonly used to determine the presence or absence of record 6 min read C# | Check if two String objects have the same value | Set-1 String.Equals Method method is used to check whether the two String objects have the same value. This method can be overloaded by passing different numbers and types of parameters to it. There are total 5 methods in the overload list of this method in which the first 2 are discussed in this article 3 min read File.Exists() Method in C# with Examples File.Exists(String) is an inbuilt File class method that is used to determine whether the specified file exists or not. This method returns true if the caller has the required permissions and path contains the name of an existing file; otherwise, false. Also, if the path is null, then this method re 2 min read How to Read From a File in C? File handing in C is the process in which we create, open, read, write, and close operations on a file. C language provides different functions such as fopen(), fwrite(), fread(), fseek(), fprintf(), etc. to perform input, output, and many different C file operations in our program. In this article, 2 min read Like