📌  相关文章
📜  如何检查文件是否包含图像c#代码示例

📅  最后修改于: 2022-03-11 14:48:38.653000             🧑  作者: Mango

代码示例1
public static readonly List ImageExtensions = new List { ".JPG", ".JPE", ".BMP", ".GIF", ".PNG" };

private void button_Click(object sender, RoutedEventArgs e)
{
    var folder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
    var files = Directory.GetFiles(folder);
    foreach(var f in files)
    {
        if (ImageExtensions.Contains(Path.GetExtension(f).ToUpperInvariant()))
        {
            // process imagek
        }
    }
}