Nov 07, 2012, 1:57 PM
ConfigItemCollection Find
This is not critical, just a thought.
I see in the ConfigItemCollection there is a Contains(string name) that returns bool based on finding a ConfigItem with that name. Could an additional method be added to return a ConfigItem or just value based on a string matching the name attribute.
Currently one of my developers was just performing closedNode.CustomAttributes(0).Value. Since she built the custom attributes she knew the first attribute would always be her "Level" attribute.
I had her change it to closedNode.CustomAttributes.First(a => a.Name == "Level").Value.
Would it be better to add a method so she could call it like closedNode.CustomAttributes.Find("Level") or a method like TryGetValue("Level", out Value)?
Since the ConfigItemCollection is not a dictionary various ConfigItems could have the same name attribute. Would you need to add FindFirst, FindLast, FindAll?
I initially thought the ConfigItemCollection would be a dictionary until I look at the code.
I see in the ConfigItemCollection there is a Contains(string name) that returns bool based on finding a ConfigItem with that name. Could an additional method be added to return a ConfigItem or just value based on a string matching the name attribute.
Currently one of my developers was just performing closedNode.CustomAttributes(0).Value. Since she built the custom attributes she knew the first attribute would always be her "Level" attribute.
I had her change it to closedNode.CustomAttributes.First(a => a.Name == "Level").Value.
Would it be better to add a method so she could call it like closedNode.CustomAttributes.Find("Level") or a method like TryGetValue("Level", out Value)?
Since the ConfigItemCollection is not a dictionary various ConfigItems could have the same name attribute. Would you need to add FindFirst, FindLast, FindAll?
I initially thought the ConfigItemCollection would be a dictionary until I look at the code.