i have a list like this :
List list_lines = new List();
list_lines.add(\"name1__pass1__com__14__55\");
list_lines.add(\"name2__pas
You can take advantage of lambda expression in LINQ functions like OrderBy
string[] Separator = new string[] { "__" };
var sortedList = list_lines
.OrderBy(s => int.Parse(s.Split(Separator, StringSplitOptions.None)[4]))
.ToList();
As an unrelated side note, please use correct C# naming conventions so your code is easier to read and is unified with existing C# code-base. E.g. not beginning local variable names with capital letter (Separator
-> separator
) and using lower camel case (Pascal case) in case it contains more words (list_lines
-> listLines
)