Creating an array from a method
Creating an array from a method
(OP)
I am attempting to construct an array from a method, but I am receiving an error that the array must have an array size or array initializer. I thought the code below would do this, but it seems that C# is wanting more information up front, and I am not entirely sure what to give it. If I try to add "new string[] method", that does not work either.
Thanks in advance.
CODE
string[] testArray = testFunction(Directory); public string[] BuildDirArr(string dirtoproc) {string[] getAllDirs = Directory.GetDirectories(dirtoproc);// Do pattern matching on the directories here in a for loop, discarding those that do not match.//+ The for loop adds good directories to a list, then I do a list to array conversion before doing return.return(MatchingDirs);}
Thanks in advance.
RE: Creating an array from a method