Reputation: 375
I am trying to compare customer names to names in C:\ftp\ to make sure they exist. I am having trouble with my if statement. I think I need to convert my array to a string but I'm not sure how. I am new to programming here is what I have:
protected bool customerCheck()
{
bool returnvalue = false;
// check if costumer exist
string[] files = Directory.GetDirectories(@"C:\ftp\");
if (Request["ftpload"] == files)
{
returnvalue = true;
}
return returnvalue;
}
Upvotes: 0
Views: 21
Reputation: 499002
You are trying to compare a string
to an array of string
s. This can't work.
You need to check if the wanted string is present in the array.
Something like:
if (files.Contains(Request["ftpload"]))
Or a loop:
foreach(string file in files)
{
if(file == Request["ftpload"])
{
return true;
}
}
Upvotes: 2