public static GetExtension ( string filename ) : string | ||
filename | string | |
Résultat | string |
private IDictionary <string, long> BytesUsedByExtension(Directory d) { IDictionary <string, long> bytesUsedByExtension = new Dictionary <string, long>(); foreach (string file in d.ListAll()) { string ext = IndexFileNames.GetExtension(file); long previousLength = bytesUsedByExtension.ContainsKey(ext) ? bytesUsedByExtension[ext] : 0; bytesUsedByExtension[ext] = previousLength + d.FileLength(file); } bytesUsedByExtension.Keys.RemoveAll(ExcludedExtensionsFromByteCounts()); return(bytesUsedByExtension); }
private IDictionary <string, long> BytesUsedByExtension(Directory d) { IDictionary <string, long> bytesUsedByExtension = new JCG.Dictionary <string, long>(); foreach (string file in d.ListAll()) { string ext = IndexFileNames.GetExtension(file); long previousLength = bytesUsedByExtension.TryGetValue(ext, out long length) ? length : 0; bytesUsedByExtension[ext] = previousLength + d.FileLength(file); } foreach (string item in ExcludedExtensionsFromByteCounts) { bytesUsedByExtension.Remove(item); } return(bytesUsedByExtension); }