I have an array of strings like this:
// icon, category, tool String[,] subButtonData = new String[,] { {"graphics/gui/brushsizeplus_icon", "Draw", "DrawBrushPlus"}, {"graphics/gui/brushsizeminus_icon", "Draw", "DrawBrushMinus"}, {"graphics/gui/freedraw_icon", "Draw", "DrawFree"}, {"graphics/gui/linedraw_icon", "Draw", "DrawLine"}, {"graphics/gui/rectangledraw_icon", "Draw", "DrawRectangle"}, {"graphics/gui/ellipsedraw_icon", "Draw", "DrawEllipse"}, {"graphics/gui/brushsizeplus_icon", "Brusher", "BrusherBrushPlus"}, {"graphics/gui/brushsizeminus_icon", "Brusher", "BrusherBrushMinus"}, {"graphics/gui/brushsizeplus_icon", "Text", "TextBrushPlus"}, {"graphics/gui/brushsizeminus_icon", "Text", "TextBrushMinus"}, };
Then I populate the List<Button> with my Button type named mainButtons
This is how I request to group for Category :
var categories = from b in mainButtons group b by b.category into g select new { Category = g.Key, Buttons = g };
How can I select the first element of each group in my main list? (without repeating each and adding to another list?)
JML Aug 05 2018-11-11T00: 00Z
source share