//using System.Linq;
static
void
Main(
string
[] args)
{
string
[] coms =
new
string
[] {
"CON1"
,
"CON10"
,
"CON12"
,
"CON13"
,
"CON26"
,
"CON5"
,
"CON6"
,
"CON7"
};
var
sorted = coms.Select(x =>
new
{
x,
num = Convert.ToInt32(x.Replace(
"CON"
,
""
))
})
.OrderBy(x => x.num)
.Select(x => x.x);
foreach
(
string
s
in
sorted)
Console.WriteLine(s);
Console.ReadLine();
}
string
[] str =
new
string
[] {
"CON1"
,
"CON10"
,
"CON12"
,
"CON13"
,
"CON26"
,
"CON5"
,
"CON6"
,
"CON7"
};
var
result =
from
n
in
str
orderby
Convert.ToInt32(n.Replace(
"CON"
,
""
))
ascending
select
n;
string
[] sort = result.ToArray();