GetExtension() публичный статический Метод

Return the extension (anything after the first '.'), or null if there is no '.' in the file name.
public static GetExtension ( string filename ) : string
filename string
Результат 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);
        }
Пример #2
0
        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);
        }