大神你们好!我在看别人的代码风格是发现一个不熟悉的c#用法请大声指点一下!
public enum FileType
{
image = 1,
video = 2,
ppt = 3,
word = 4,
excel = 5,
pdf = 6,
other = 0,
}
public static Dictionary> getTypeDic()
{
Dictionary> fileExtensionDic = new Dictionary>()
{
{FileType.image ,
new List(){"jpg","jpeg","bmp","gif","png","tiff"}},
{FileType.video ,
new List(){"mp4","avi","wmv","rmvb","rm","mpeg","mpg","dat","flv","3pg","mov"}},
{FileType.word ,
new List(){"txt","text","doc","docx","docm","dot","dotx","dotm","rtf"}},
{FileType.ppt ,
new List(){"ppt","pptx","pptm","ppsx","potx","pot","ppam"}},
{FileType.excel ,
new List(){"xls","xlsm","xlts","xltx","xltm","xlsb","xlam"}},
{FileType.pdf ,
new List(){"pdf"}},
{FileType.other ,
new List(){"*"}}//TODO:这里可能会有问题,是否应该应用空字串来表达
};
return fileExtensionDic;
}
---------------------------------------------------------------------------
public static List getFileExtensions(FileType type)
{
return getTypeDic()[type]; //!!这里 函数名()[] 很怪异???
}