[xbuild] ImportCollections.TryGetImport and other fixes
authorAnkit Jain <radical@corewars.org>
Thu, 3 Mar 2011 14:31:23 +0000 (20:01 +0530)
committerAnkit Jain <radical@corewars.org>
Thu, 3 Mar 2011 19:20:30 +0000 (00:50 +0530)
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ImportCollection.cs

index 3851aa6c571536fe681ad7c794496f3f79a6460a..6a956d2858423187d44d474364255fc78eb2924d 100644 (file)
@@ -37,19 +37,19 @@ namespace Microsoft.Build.BuildEngine {
        public class ImportCollection : ICollection, IEnumerable {
                
                GroupingCollection groupingCollection;
-               Dictionary <string, object> filenames;
+               Dictionary <string, Import> filenames;
                
                internal ImportCollection (GroupingCollection groupingCollection)
                {
                        this.groupingCollection = groupingCollection;
-                       filenames = new Dictionary <string, object> ();
+                       filenames = new Dictionary <string, Import> ();
                }
                
                internal void Add (Import import)
                {
                        if (!filenames.ContainsKey (import.EvaluatedProjectPath)) {
                                groupingCollection.Add (import);
-                               filenames.Add (import.EvaluatedProjectPath, null);
+                               filenames.Add (import.EvaluatedProjectPath, import);
                        }
                }
                
@@ -77,6 +77,11 @@ namespace Microsoft.Build.BuildEngine {
                {
                        return filenames.ContainsKey (import.EvaluatedProjectPath);
                }
+
+               internal bool TryGetImport (Import keyImport, out Import valueImport)
+               {
+                       return filenames.TryGetValue (keyImport.EvaluatedProjectPath, out valueImport);
+               }
                
                public void CopyTo (Import[] array, int index)
                {