I have learned a little C # before, I haven't used it for a long time. I didn't think of it. I really forgot a lot of things, (is really old ??), in order to write a list of specified extensions (more The small function of the extension) file has spent two hours, and the functions to use must go over and over the MSDN. It seems that it is really not practicing for three days. I wrote a half-day, writing it. I am still not satisfied, I also hope that everyone criticizes the correct, the source code is as follows ...
Private array getAllFiles (String strpath) {DirectoryInfo Di = New DirectoryInfo (StrPath); fileinfo [] result = di.getfiles (); string stretsTfilter = "jpg, .bmp, .gif"; // Require file extension ARRAYLIST AL = New ArrayList (Result); int Num = al.count; int count = 0; for (int i = 0; i
{
FileInfo sf = (fileInfo) al [count];
IF (SF.EXTension.Tolower ()) == - 1) || (sf.extension == ")) // The extension of the current file exists in the filter list
{
Al.Remove (sf); // If you don't exist, you can delete this item.
count -;
}
COUNT ;
}
Return al.toArray ();
}