public string GetFileExt(string file) { int lastDotIdx = file.LastIndexOf("."); if (lastDotIdx == -1) return ""; return file.Substring(lastDotIdx, file.Length-lastDotIdx); }