2
Answers

Using system classes

Scott Stewart

Scott Stewart

12y
1.1k
1
I am not sure if the title is even the correct use of the words system and classes. I was trying to write a function that looks for a specific file in a specific location. I added "using System.IO" to the directives and looking through the object browser I came across this;

"public override bool Exists { get; }
    Member of System.IO.FileInfo

Summary:
Gets a value indicating whether a file exists.

Returns:
true if the file exists; false if the file does not exist or if the file is a directory."

Generally speaking, how can I use this? I started to try FileInfo.Exists @"c:\file path\ and name.and extension" but that wasn't accepted. All I want is to set a boolean if the file exists.

Thank you again.

Answers (2)