tonelm54
asked on
Return array
Im trying to make a simple function to remove a string from each element in an array and then return the array (simple ehh)
So, what Ive got is:-
However I cant compile as I get the error, on the line 'return arrFiles':-
Any ideas how I can fix this?
So, what Ive got is:-
public class RemoteFolder
{
public string RemoveFolderStings(string[] arrFiles, string folderName)
{
foreach (var fil in arrFiles)
{
fil.ToString().Replace(folderName, "");
}
return arrFiles;
}
}
However I cant compile as I get the error, on the line 'return arrFiles':-
Cannot convert expression type 'string[]' to return type 'string'
Any ideas how I can fix this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just for clarity. You specified the function to return a single string, not an array of strings hence the error. Just do what Jeff says to correct it.
ASKER
Thank you