I've been trying to alphabetize this Bitmap Array in C# as the resources aren't alphabetized in the resx file.
I've gotten the resource to an array with this code
var resourceSet = Properties.Resources.ResourceManager.GetResourceSet(System.Globalization.CultureInfo.CurrentUICulture, true, true);
System.Drawing.Bitmap[] imageArray = resourceSet.OfType<DictionaryEntry>()
.Select(i => (System.Drawing.Bitmap)i.Value)
.ToArray();
Your problem is that in your
Select
, you lose theKey
that you want to sort on. Use an anonymous type or a new class to keep the name and image: