如何获取所有 .resx 文件的名称并加载到 C# 中的 ComboBox

How to get the name of all .resx files and load into a ComboBox in C#

是否可以获取.resx 文件的名称?在运行时。我需要捕获这些名称以获取可用语言并将它们加载到组合框中。 我有一个文件夹

ProjectName
    Multilanguage
       Language.resx
       Language.en-US.resx
       Language.fr-FR.resx

我需要数组中的名称 Language.resx、Language.en-US.resx 和 Language.fr-FR.resx

谢谢!

您可以使用GetFiles method on the Directory class 递归获取所有文件。它甚至支持一种模式:

string[] result = System.IO.Directory.GetFiles(@"C:\source\project", 
                  "*.resx", System.IO.SearchOption.AllDirectories);