Consider the code below
class Pin
{
string Name; //can be either Numerical or AlphaNum
}
enum Place
{
Left,
Right
}
class Map
{
Pin pin;
Place Place;
Rectangle Rect;
}
The Pin
's Name
field can be only numerical or alphanumerical, so I went by string to support both.
Now My quesion is if I have a List<Map>
how can I sort this list by Pin's Name field? I tried the code below but it can't compile:
map.Sort((x, y) => x.Pin.Name.CompareTo(y.Pin.Name));
//Cannot implicitly convert type 'void' to 'System.Collections.Generic.List<DataModels.PinMap>