I have a folder with several Directories that are named after a version of an update such as UPDATE_20080311_3.5.9. I need to find the latest update on that list by veryfing the "3.5.9", I made a code to parse the name and add just the version to a list. Is there anyway to Sort tha list by using List.Sort in order to get the latest version "number"? This is the code I made so far, I don't know how to properly use the .Sort() method and if this can be done. I appreciate any help given
public string NewerVersion(string Directoria)
{
List<string> Lista = new List<string>();
DirectoryInfo dir = new DirectoryInfo(Directoria);
DirectoryInfo[] dirs = dir.GetDirectories();
foreach (DirectoryInfo Info in dirs)
{
string Dir = Info.Name.ToString();
Lista.Add(Dir.Substring(Dir.LastIndexOf('_'), Dir.Length));
}
Lista.Sort()
//Lista.ToArray();
}