found twice when it's actually present only once (!). Attempt to
work around this by usinq LINQ instead of a foreach (which oddly
works...).
svn path=/trunk/mcs/; revision=139252
+2009-08-02 Jonathan Pryor <jpryor@novell.com>
+
+ * Mono.Documentation/monodocer.cs: Sometimes <AssemblyVersion/> is
+ found twice when it's actually present only once (!). Attempt to
+ work around this by usinq LINQ instead of a foreach (which oddly
+ works...).
+
2009-07-31 Jonathan Pryor <jpryor@novell.com>
* Mono.Documentation/monodocer.cs: Record attributes that are placed
e = root.OwnerDocument.CreateElement("AssemblyInfo");
root.AppendChild(e);
}
- MyXmlNodeList matches = new MyXmlNodeList (assemblyVersions.Length);
- foreach (XmlElement v in e.SelectNodes ("AssemblyVersion")) {
- foreach (string sv in assemblyVersions)
- if (v.InnerText == sv)
- matches.Add (v);
- }
+ List<XmlNode> matches = e.SelectNodes ("AssemblyVersion").Cast<XmlNode>()
+ .Where(v => Array.IndexOf (assemblyVersions, v.InnerText) >= 0)
+ .ToList ();
// matches.Count > 0 && add: ignore -- already present
if (matches.Count > 0 && !add) {
foreach (XmlNode c in matches)