Windows Phone Developers

Saturday, November 1, 2008

Check if file exists using C# (.NET)

Check Existence of File using C# (.NET)

Exists method of the System.IO.File class can be used to check if a file exists in a given location.

private static bool Check_file_Existence(string sFileName)

{

try

{

if (File.Exists(sFileName) == true)

{return true;

}

else

{ return false; }

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

return false;

}

}

, IsExist Method in .NET, .NET File Class, .NET Exists Method

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

1 comment:

  1. Hi i am new to vs 2005 compiling.

    I tried to compile a source code and got this error:

    http://libomv.pastebin.ca/1794428

    Please help me find out how to fix it thank you so much.


    April
    xoxoxoxoxoxox

    ReplyDelete