C# 9 システムフォルダに存在するOS DLLを取得するサンプルコードです。バージョン情報の製品名が「Microsoft® Windows® Operating System」のDLLをOS DLLとみなしています。
using System; using System.Diagnostics; using System.IO; using System.Linq; var osDllFileNames = GetOperatingSystemDLLFileNamesInSystemFolder(); foreach (var osDllFileName in osDllFileNames) { Console.WriteLine(osDllFileName); } static string[] GetOperatingSystemDLLFileNamesInSystemFolder() { var winDirPath = Environment.GetFolderPath(Environment.SpecialFolder.System); return Directory.GetFiles(winDirPath, "*.dll") .Where(path => FileVersionInfo.GetVersionInfo(path).ProductName == "Microsoft® Windows® Operating System") .Select(path => Path.GetFileName(path)) .ToArray(); }