I am trying to get a list of folder names in an array format.In order to do this, I used the Directory.GetDirectories("") method to fetch the path for all the folders in a certain directory and saved it to a string variable.
Then I loop through each object within the string variable called item. I am trying to get the LastIndexOf() of the path ‘\’ for each item object so I can then get the pure foldername without the slashes (\) in the path.
However,I keep getting the following error in the exclamation mark:
‘object.ToString()’ is a method, which is not valid in the given context
Can’t figure out why - can someone please help?
I am following steps similar to the video here