Iata mai jos si un exemplu:
string path = "d:/locatie";
if(System.IO.Directory.Exist(path))
{
//path-ul este valid.
} else
{
// path-ul nu este valid.
}
In cazul in care path-ul contine si numele unui fisier putem sa facem urmatorul artificiu:string path = "d:/locatie/a.txt";
if(System.IO.Directory.Exist(GetDirectoryName(path)))
{
//path-ul este valid.
} else
{
// path-ul nu este valid.
}
0 comments:
Post a Comment