Write below function to get all the files and sub folders,
public static List<string> GetAllFiles(string directory)
{
return Directory.GetFiles(directory, "*", SearchOption.AllDirectories).ToList();
}Then call this above function where you wanted to use it as below code,
List<string> Files = GetAllFiles(Environment.CurrentDirectory);
int count= Files.Count; //get count of files inside given directory