110,567
社区成员
发帖
与我相关
我的任务
分享
private void Test()
{
dataGridView.Rows.Clear();
foreach (var name in dic.Keys)
{
if (name.StartsWith("Final") || name.StartsWith("Sub")) //此处应如何设计满足不同的需求?
{
int rowIndex = dataGridView.Rows.Add();
foreach (DataGridViewColumn column in dataGridView.Columns)
{
DataGridViewCell currentCell = dataGridView.Rows[rowIndex].Cells[column.Index];
currentCell.Value = dic[name];
}
}
}
}
Expression<Func<Dictionary<string, Dictionary<string, string>>, bool>> Filter;
Dictionary<string, Dictionary<string, Dictionary<string, string>>> AllAttrs=new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
Filter = (x) => AllAttrs[""].Where(d => d.Key.StartsWith("Final")) == x;
class AttributeTag
{
public Expression<Func<Dictionary<string, Dictionary<string, ExtendedAttribute>>, bool>> Filter { get; set; }
//...
}
class JobInfo
{
public static Dictionary<InterfaceType, Dictionary<string, Dictionary<string, ExtendedAttribute>>> AllAttrs { get; set; }
//...
}
private void Test()
{
var dic = JobInfo.AllAttrs[InterfaceType.PROCESS];
attributeTag = new AttributeTag
{
Filter = dic.Where(d => d.Key.StartsWith("Final") || d.Key.StartsWith("Sub") || d.Key.StartsWith("Buired")),
InterfaceType = InterfaceType.PROCESS
};
dgvResinPlug.Tag = attributeTag;
}
第19行提示错误,请问如何修改:
无法将类型
“System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, System.Collections.Generic.Dictionary<string, EntryForm.Models.ExtendedAttribute>>>”
隐式转换为
“System.Linq.Expressions.Expression<System.Func<System.Collections.Generic.Dictionary<string, System.Collections.Generic.Dictionary<string, EntryForm.Models.ExtendedAttribute>>, bool>>”