class Program
{
public struct CommandStruct
{
public string aCategory; // Eine Category kann mehrere Commands haben.
public string aCommand; // Ein Command kann nur eine Category haben. (Jedes Command ist eingigartig)
public string aShortcut; // Ein Shortcut kann nur zu einem Command gehören.
public string aToolTip; // Mehrere Commands können einen gleichen ToolTip haben.
public string aImage; // Mehrere Commands können sich ein Image teilen.
}
static void Main(string[] args)
{
List<CommandStruct> m_CommandStructList = new List<CommandStruct>();
m_CommandStructList.Add(new CommandStruct() { aCategory = "Cat1", aCommand = "Com1", aShortcut = "Strg+A", aImage = "Image1", aToolTip = "fdbgio" });
m_CommandStructList.Add(new CommandStruct() { aCategory = "Cat1", aCommand = "Com2", aShortcut = "Strg+B", aImage = "Image2", aToolTip = "fdbgfhrjio" });
m_CommandStructList.Add(new CommandStruct() { aCategory = "Cat2", aCommand = "Com3", aShortcut = "Strg+C", aImage = "Image1", aToolTip = "trh" });
m_CommandStructList.Add(new CommandStruct() { aCategory = "Cat2", aCommand = "Com4", aShortcut = "Strg+D", aImage = "Image2", aToolTip = "fdbgio" });
m_CommandStructList.Add(new CommandStruct() { aCategory = "Cat2", aCommand = "Com5", aShortcut = "Strg+E", aImage = "Image1", aToolTip = "fdbfjjgio" });
var shortcut = from com in m_CommandStructList
where com.aCategory == "Cat1" && com.aCommand == "Com2"
select com.aShortcut;
Console.WriteLine(shortcut.First());
var commands = from com in m_CommandStructList
where com.aCategory == "Cat2"
select com;
foreach (CommandStruct cs in commands)
{
Console.WriteLine(cs.aCommand);
}
}
}[/PHP]