Skip to content

Commit 0bc6323

Browse files
authored
Cleanup: Delete Pair of TKey, TValue (#9265)
1 parent e881d34 commit 0bc6323

File tree

11 files changed

+87
-156
lines changed

11 files changed

+87
-156
lines changed

src/Build/Definition/ProjectItem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,11 +1020,11 @@ public ProjectItem CreateItem(string evaluatedIncludeEscaped, string evaluatedIn
10201020
/// <summary>
10211021
/// Applies the supplied metadata to the destination item.
10221022
/// </summary>
1023-
public void SetMetadata(IEnumerable<Pair<ProjectMetadataElement, string>> metadata, IEnumerable<ProjectItem> destinationItems)
1023+
public void SetMetadata(IEnumerable<KeyValuePair<ProjectMetadataElement, string>> metadata, IEnumerable<ProjectItem> destinationItems)
10241024
{
10251025
foreach (IItem<ProjectMetadata> item in destinationItems)
10261026
{
1027-
foreach (Pair<ProjectMetadataElement, string> metadatum in metadata)
1027+
foreach (KeyValuePair<ProjectMetadataElement, string> metadatum in metadata)
10281028
{
10291029
item.SetMetadata(metadatum.Key, metadatum.Value);
10301030
}

src/Build/Evaluation/Evaluator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ internal class Evaluator<P, I, M, D>
9292
/// Key is the directory of the file importing the usingTask, which is needed
9393
/// to handle any relative paths in the usingTask.
9494
/// </summary>
95-
private readonly List<Pair<string, ProjectUsingTaskElement>> _usingTaskElements;
95+
private readonly List<KeyValuePair<string, ProjectUsingTaskElement>> _usingTaskElements;
9696

9797
/// <summary>
9898
/// List of ProjectTargetElement's traversing into imports.
@@ -249,7 +249,7 @@ private Evaluator(
249249
_data = data;
250250
_itemGroupElements = new List<ProjectItemGroupElement>();
251251
_itemDefinitionGroupElements = new List<ProjectItemDefinitionGroupElement>();
252-
_usingTaskElements = new List<Pair<string, ProjectUsingTaskElement>>();
252+
_usingTaskElements = new List<KeyValuePair<string, ProjectUsingTaskElement>>();
253253
_targetElements = new List<ProjectTargetElement>();
254254
_importsSeen = new Dictionary<string, ProjectImportElement>(StringComparer.OrdinalIgnoreCase);
255255
_initialTargetsList = new List<string>();
@@ -913,7 +913,7 @@ private void PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
913913
EvaluateImportGroupElement(currentProjectOrImport.DirectoryPath, importGroup);
914914
break;
915915
case ProjectUsingTaskElement usingTask:
916-
_usingTaskElements.Add(new Pair<string, ProjectUsingTaskElement>(currentProjectOrImport.DirectoryPath, usingTask));
916+
_usingTaskElements.Add(new KeyValuePair<string, ProjectUsingTaskElement>(currentProjectOrImport.DirectoryPath, usingTask));
917917
break;
918918
case ProjectChooseElement choose:
919919
EvaluateChooseElement(choose);

src/Build/Evaluation/Expander.cs

Lines changed: 74 additions & 79 deletions
Large diffs are not rendered by default.

src/Build/Evaluation/IItemFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ ProjectItemElement ItemElement
6868
/// <summary>
6969
/// Applies the supplied metadata to the destination items.
7070
/// </summary>
71-
void SetMetadata(IEnumerable<Pair<ProjectMetadataElement, string>> metadata, IEnumerable<T> destinationItems);
71+
void SetMetadata(IEnumerable<KeyValuePair<ProjectMetadataElement, string>> metadata, IEnumerable<T> destinationItems);
7272
}
7373
}

src/Build/Evaluation/LazyItemEvaluator.ItemFactoryWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public I CreateItem(string include, I baseItem, string definingProject)
7575
return _wrappedItemFactory.CreateItem(include, baseItem, definingProject);
7676
}
7777

78-
public void SetMetadata(IEnumerable<Pair<ProjectMetadataElement, string>> metadata, IEnumerable<I> destinationItems)
78+
public void SetMetadata(IEnumerable<KeyValuePair<ProjectMetadataElement, string>> metadata, IEnumerable<I> destinationItems)
7979
{
8080
SetItemElement();
8181
_wrappedItemFactory.SetMetadata(metadata, destinationItems);

src/Build/Evaluation/LazyItemEvaluator.LazyItemOperation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ protected void DecorateItemsWithMetadata(IEnumerable<ItemBatchingContext> itemBa
230230
_expander.Metadata = metadataTable;
231231

232232
// Also keep a list of everything so we can get the predecessor objects correct.
233-
List<Pair<ProjectMetadataElement, string>> metadataList = new(metadata.Length);
233+
List<KeyValuePair<ProjectMetadataElement, string>> metadataList = new(metadata.Length);
234234

235235
foreach (var metadataElement in metadata)
236236
{
@@ -252,7 +252,7 @@ protected void DecorateItemsWithMetadata(IEnumerable<ItemBatchingContext> itemBa
252252
evaluatedValue = FileUtilities.MaybeAdjustFilePath(evaluatedValue, metadataElement.ContainingProject.DirectoryPath);
253253

254254
metadataTable.SetValue(metadataElement, evaluatedValue);
255-
metadataList.Add(new Pair<ProjectMetadataElement, string>(metadataElement, evaluatedValue));
255+
metadataList.Add(new KeyValuePair<ProjectMetadataElement, string>(metadataElement, evaluatedValue));
256256
}
257257

258258
// Apply those metadata to each item

src/Build/Instance/ProjectItemInstance.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,7 +2007,7 @@ public ProjectItemInstance CreateItem(string evaluatedInclude, string evaluatedI
20072007
/// <summary>
20082008
/// Applies the supplied metadata to the destination item.
20092009
/// </summary>
2010-
public void SetMetadata(IEnumerable<Pair<ProjectMetadataElement, string>> metadataList, IEnumerable<ProjectItemInstance> destinationItems)
2010+
public void SetMetadata(IEnumerable<KeyValuePair<ProjectMetadataElement, string>> metadataList, IEnumerable<ProjectItemInstance> destinationItems)
20112011
{
20122012
// Set up a single dictionary that can be applied to all the items
20132013
CopyOnWritePropertyDictionary<ProjectMetadataInstance> metadata = new CopyOnWritePropertyDictionary<ProjectMetadataInstance>();
@@ -2172,7 +2172,7 @@ public TaskItem CreateItem(string includeEscaped, string includeBeforeWildcardEx
21722172
/// <summary>
21732173
/// Applies the supplied metadata to the destination item.
21742174
/// </summary>
2175-
public void SetMetadata(IEnumerable<Pair<ProjectMetadataElement, string>> metadata, IEnumerable<TaskItem> destinationItems)
2175+
public void SetMetadata(IEnumerable<KeyValuePair<ProjectMetadataElement, string>> metadata, IEnumerable<TaskItem> destinationItems)
21762176
{
21772177
// Not difficult to implement, but we do not expect to go here.
21782178
ErrorUtilities.ThrowInternalErrorUnreachable();

src/Build/Logging/ProfilerLogger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private static Dictionary<EvaluationLocation, ProfiledLocation> PruneSmallItems(
219219

220220
// Let's build an index of profiled locations by id, to speed up subsequent queries
221221
var idTable = aggregatedLocations.ToDictionary(pair => pair.Key.Id,
222-
pair => new Pair<EvaluationLocation, ProfiledLocation>(pair.Key, pair.Value));
222+
pair => new KeyValuePair<EvaluationLocation, ProfiledLocation>(pair.Key, pair.Value));
223223

224224
// We want to keep all evaluation pass entries plus the big enough regular entries
225225
foreach (var prunedPair in aggregatedLocations.Where(pair =>
@@ -237,7 +237,7 @@ private static Dictionary<EvaluationLocation, ProfiledLocation> PruneSmallItems(
237237
/// <summary>
238238
/// Finds the first ancestor of parentId (which could be itself) that is either an evaluation pass location or a big enough profiled data.
239239
/// </summary>
240-
private static long? FindBigEnoughParentId(IDictionary<long, Pair<EvaluationLocation, ProfiledLocation>> idTable,
240+
private static long? FindBigEnoughParentId(IDictionary<long, KeyValuePair<EvaluationLocation, ProfiledLocation>> idTable,
241241
long? parentId)
242242
{
243243
// The parent id is null, which means the item was pointing to an evaluation pass item. So we keep it as is.

src/Build/Microsoft.Build.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@
8686
<Compile Include="..\Shared\NGen.cs">
8787
<Link>SharedUtilities\NGen.cs</Link>
8888
</Compile>
89-
<Compile Include="..\Shared\Pair.cs">
90-
<Link>SharedUtilities\Pair.cs</Link>
91-
</Compile>
9289
<Compile Include="..\Shared\PropertyParser.cs">
9390
<Link>BackEnd\Components\RequestBuilder\IntrinsicTasks\PropertyParser.cs</Link>
9491
<ExcludeFromStyleCop>True</ExcludeFromStyleCop>

src/Shared/Pair.cs

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)