public List <Folder> folders() { ApiCall apiCall = new ApiCall { }; List <Folder> folders = new List <Folder> { }; List <string> folderseses = new List <string> { }; folderseses = apiCall.GetFolders(); foreach (string folder in folderseses) { string[] fileName = folder.Split('\\'); Folder fold = new Folder(); fold.path = folder; fold.Name = (fileName[fileName.Length - 1]); folders.Add(fold); } return(folders); }