Q:

ssh.net check file extension

I used SSH.NET library to connect to sftp server and manage to download file from server. In the server there is lot of file types I only need CSV file to download. How can I check the file extension GetExtension is not working in SSH.NET. Help is highly appreciate.  
            foreach (var file in files)
            {
                if (!file.Name.StartsWith("."))
                {
                    string remoteFileName = file.Name;

                    using (Stream fileStream = System.IO.File.OpenWrite(Path.Combine(sFilePath, file.Name)))
                    {
                        sftp.DownloadFile(file.FullName, fileStream);
                    }

                }
            }

A:

I found a solution I'm posting it here for helping anyone who has the same problem like me.
 string fname = file.Name;
 string ext = fname.Substring(fname.Length - 4, 4);

 if (ext == ".csv")
 {
     //code goes here
 }

