我想在C#中创建一个键值对的集合,其中键是ASP.net控件的属性(例如ID),值是该属性的值。我想这样做,以便稍后可以迭代集合并查看给定的控件是否在我的集合中具有属性(并且控件中的属性值与我的集合中定义的值相匹配)。任何建议最好的方式来做到这一点?谢谢你的帮助。收藏物业=>价值?
伪代码示例:
Properties[] = new Properties[] {new Property(){name="ID",value="TestControl1"}, new Property(){name = "Text",value="Type text here"}}
private bool controlContainsProperties(Control control){
foreach(Property Property in Properties[])
{
if((control does not contain property) || (control property value != Property.Value))
return false;
}
return true;
}