I have the following list of string
var strTest = new List<string> { "B2", "B1", "B10", "B3" };
I want to sort them as follows "B1, B2, B3, B10".
If I use LINQ OrderBy it sorts this way "B1, B10, B2, B3"
Please help. Here's my code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SortingDemo
{
class Program
{
static void Main(string[] args)
{
var strTest = new List<string> { "B2", "B1", "B10", "B3" };
var sort = strTest.OrderBy(x => x);
var sortedStr = string.Join(",", sort);
Console.WriteLine(sortedStr);
Console.ReadLine();
}