0
目前我使用一種方法,它根據從提供的鍵得到的字符串比較返回ICommand對象。幫助需要在泛型中使用謂詞
public ICommand getCommand(string mCommand)
{
foreach (object obj in objCommandList)
{
ICommand command = (ICommand)obj;
if (command.m_strCommandName == mCommand)
{
return command;
}
}
return null;
}
其中objCommandList包含ICommand對象。
現在我想提高我的代碼,或者說嘗試的替代集合當中搜索即使用選項,例如謂詞代表在獲取過濾的對象集合之中。
即。
objCommandList.Find(Predicate syntax which is needed here...)
任何人都可以幫助我解決這個問題。
非常感謝! – 2011-06-01 11:36:05