If I do simply
dirInfoObj.GetFiles("*.jpg")
, it will return the 2 jpg's I have there. But if I try and get both jpg's and png's, like
开发者_Python百科dirInfoObj.GetFiles("*.jpg,*.png")
, it won't return anything.
Am I doing something wrong? Thanks!
There is nothing in the documentation for GetFiles that indicates that it supports usage of the , character like you mean it. If you are using LINQ, you could do something like:
var files = dirInfoObj.GetFiles("*.jpg").Concat(dirInfoObj.GetFiles("*.png"));
If you need files
to be an array, just throw a .ToArray()
on the end.
The MSDN entry on GetFiles
http://msdn.microsoft.com/en-us/library/8he88b63.aspx
states how it can be used.
It does not support a comma operator for multiple extensions.
精彩评论