C# 程序获取目录中存在的所有文件
Introduction
On the computer, we can store files in a directory, also known as a folder. A directory also contains shortcuts to other directories and files. If we want to know what all files have stored in a directory then C# also offers an easy way to do so. In this article, we will be learning a C# program to get all files present in a directory.
There are more than a couple of ways to know the files available in the directory. Let us discuss them in the upcoming sections.
1. GetFiles() 方法
为了知道指定目录中存在的文件的名称,我们使用GetFiles()方法。
public static string[] GetFiles (string path); 登录后复制