Presently i use a method which returns me the ICommand object based on the string comparisons got from the supplied key.
public ICommand getCommand(string mCommand)
{
foreach (object obj in objCommandList)
{
ICommand command = (ICommand)obj;
if (command.m_strCommandName == mCommand)
{
return command;
}
}
return null;
}
where objCommandList contains ICommand objects.
Now I want to improve my code or rather try an alternative to search amongst the collection i.e using an option such as Predicate delegate in retrieving the filtered object amongst the collection.
ie.
objCommandList.Find(Predicate syntax which is needed here...)
Can anyone help me with this.
You might try something like this:
or