Click here to Skip to main content
16,009,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My project have a filename "flower.png" in "MyProject.PhoneApp\Resources".
How to check a file exists ?
Posted

Try something like..
C#
private bool IsFileExists(string relativePath)
{
    return Application.GetResourceStream(new Uri(relativePath, UriKind.Relative)) != null;
}


Where relativePath should NOT begin with a slash.
 
Share this answer
 
v3
Comments
nvp512 7-Aug-13 14:54pm    
I did it.
thank for your advice.
ridoy 7-Aug-13 14:56pm    
that doesn't work?
nvp512 7-Aug-13 15:05pm    
no, it works very well
ridoy 7-Aug-13 15:06pm    
ok,glad to help you.hope it will help others also after your marking as answer,:).
nvp512 7-Aug-13 15:11pm    
of course. Thank you very much !
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900