-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2fbfc5
commit e6655da
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/Compilers/Core/Portable/DiagnosticAnalyzer/AdditionalTextValueProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.CodeAnalysis.Diagnostics | ||
{ | ||
/// <summary> | ||
/// Provides custom values associated with <see cref="AdditionalText"/> instances using the given computeValue delegate. | ||
/// </summary> | ||
public sealed class AdditionalTextValueProvider<TValue> | ||
{ | ||
internal readonly AnalysisValueProvider<AdditionalText, TValue> CoreValueProvider; | ||
|
||
/// <summary> | ||
/// Provides custom values associated with <see cref="AdditionalText"/> instances using the given <paramref name="computeValue"/>. | ||
/// </summary> | ||
/// <param name="computeValue">Delegate to compute the value associated with a given <see cref="AdditionalText"/> instance.</param> | ||
/// <param name="additionalTextComparer">Optional equality comparer to determine equivalent <see cref="AdditionalText"/> instances that have the same value. | ||
/// If no comparer is provided, then <see cref="EqualityComparer{T}.Default"/> is used by default.</param> | ||
public AdditionalTextValueProvider(Func<AdditionalText, TValue> computeValue, IEqualityComparer<AdditionalText>? additionalTextComparer = null) | ||
{ | ||
CoreValueProvider = new AnalysisValueProvider<AdditionalText, TValue>(computeValue, additionalTextComparer ?? EqualityComparer<AdditionalText>.Default); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters