I have a list of strings of version (see photo), and I'd like to sort them in descending order.
I've seen a few solutions using Version class to compare them, but I can't think of any solution that sort a whole list like this. What is the least complicated way to achieve this?
what is wrong with this simple implementation?
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var ver = new List<Version>();
ver.Add(new Version("3.5"));
ver.Add(new Version("3.15"));
ver.Add(new Version("3.10"));
ver.Add(new Version("3.1"));
ver.Sort();
ver.Reverse();
}
}
}