Sorting List which has object that contains two string members that contains numbers
- by Lemo
I want to know the best solution for this
my case here is that i am taking values from Excel sheet and pushing them to database field, sometimes that field might contain some strings (thats why I cant make my object members int / double)
In my class below size is the variable responsible for showing size of files in bytes
public class dataNameValue
{
public string Name { get; set; }
public string Count { get; set; }
public string Size { get; set; }
}
I wanted to sort the list by file Size something like
List mylist = new List();
mylist = mylist.OrderByDescending(i = i.Size).ToList();
The problem is that if i sorted it without converting it to "int/double" first -- its not giving right results