过滤列表中的图像 [英] filtering images in a list
本文介绍了过滤列表中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我想通过在搜索框中键入图像的值来过滤列表中的图像,请问我是否知道该怎么做
sudheer
Hi
I want filtering images in a list by typing the value of the image in a search box can i know how to do that task please
sudheer
推荐答案
引用此链接
http://www.aspsnippets.com/Articles/Using-jQuery- ImageAutoComplete-Plugin-in-ASP.Net.aspx [ ^ ]
refer this link
http://www.aspsnippets.com/Articles/Using-jQuery-ImageAutoComplete-Plugin-in-ASP.Net.aspx[^]
static void Main()
{
foreach (string match in Search("C:\\", "*.gif"))
{
Console.WriteLine(match + "");
//return;
}
}
static IEnumerable<string> Search(string root, string searchPattern)
{
Queue<string> dirs = new Queue<string>();
dirs.Enqueue(root);
while (dirs.Count > 0)
{
string dir = dirs.Dequeue();
// files
string[] paths = null;
try
{
paths = Directory.GetFiles(dir, searchPattern);
}
catch
{
}
// swallow
if (paths != null && paths.Length > 0)
{
foreach (string file in paths)
{
yield return file;
}
}
// sub-directories
paths = null;
try
{
paths = Directory.GetDirectories(dir);
}
catch
{
}
// swallow
if (paths != null && paths.Length > 0)
{
foreach (string subDir in paths)
{
dirs.Enqueue(subDir);
}
}
}
}
</string></string></string>
这篇关于过滤列表中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文