I have a datatable with several columns of strings. One column is "IPAddress". I want to sort the data table by the IP Address column. I've tried
DataView dv = dt.DefaultView;
dv.Sort = "IPAddress asc";
dt = dv.ToTable();
But of course this produces a result where, for example 10.1.1.203 comes before 10.1.1.21 instead of after.
There was a really clever solution here How to sort list of Ip Addresses using c# but this works for lists, not datatables.
Edit: This is not a duplicate question, as the linked question is almost 10 years old and a lot has changed since then, and more importantly, the question does not specifically address the problem of IP address sorting which is very specific and unique problem.