C#从文件夹中获取图像 [英] C# get images from folder

查看:117
本文介绍了C#从文件夹中获取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含以下代码的产品: 194578

I have a product with this code: 194578

有一个包含大量图片的文件夹,该产品的主要图片是 194578.JPG

There is a folder with a lot of images, the product's main image is 194578.JPG

我必须将同一产品的其他一些图片显示为详细信息,但问题是,这些其他图像我有不知道我有多少只知道他们在数字后面有一封信,比如:

There are some other images for the same product that I have to show as details but the thing is, these other images I have no idea of how much I only know they have a letter after the numbers, like:

194578A.jpg
194578B.jpg
194578C.jpg

依此类推,直到最大值 194578Z .jpg

and so on, until the max o 194578Z.jpg

我有产品代码,如何获取这些详细图片?

I have the product code, how do I get those detail images?

在此先感谢您的帮助。

推荐答案

您可以使用 Directory.GetFiles 查找与模式匹配的目录中的文件:

You can use Directory.GetFiles to find files in a directory matching a pattern:

var files = Directory.GetFiles("path/to/directory", prefix + "?.jpg");

这篇关于C#从文件夹中获取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆