AnalysisContext.TryGetValue Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
TryGetValue<TValue>(AdditionalText, AdditionalTextValueProvider<TValue>, TValue) |
Attempts to compute or get the cached value provided by the given |
TryGetValue<TValue>(SourceText, SourceTextValueProvider<TValue>, TValue) |
Attempts to compute or get the cached value provided by the given |
TryGetValue<TValue>(AdditionalText, AdditionalTextValueProvider<TValue>, TValue)
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
Attempts to compute or get the cached value provided by the given valueProvider
for the given text
.
Note that the pair {valueProvider
, text
} acts as the key.
Reusing the same valueProvider
instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
public bool TryGetValue<TValue> (Microsoft.CodeAnalysis.AdditionalText text, Microsoft.CodeAnalysis.Diagnostics.AdditionalTextValueProvider<TValue> valueProvider, out TValue value);
member this.TryGetValue : Microsoft.CodeAnalysis.AdditionalText * Microsoft.CodeAnalysis.Diagnostics.AdditionalTextValueProvider<'Value> * 'Value -> bool
Public Function TryGetValue(Of TValue) (text As AdditionalText, valueProvider As AdditionalTextValueProvider(Of TValue), ByRef value As TValue) As Boolean
Type Parameters
- TValue
The type of the value associated with the key.
Parameters
- text
- AdditionalText
AdditionalText for which the value is queried.
- valueProvider
- AdditionalTextValueProvider<TValue>
Provider that computes the underlying value.
- value
- TValue
Value associated with the key.
Returns
Returns true on success, false otherwise.
Applies to
TryGetValue<TValue>(SourceText, SourceTextValueProvider<TValue>, TValue)
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
- Source:
- DiagnosticAnalysisContext.cs
Attempts to compute or get the cached value provided by the given valueProvider
for the given text
.
Note that the pair {valueProvider
, text
} acts as the key.
Reusing the same valueProvider
instance across analyzer actions and/or analyzer instances can improve the overall analyzer performance by avoiding recomputation of the values.
public:
generic <typename TValue>
bool TryGetValue(Microsoft::CodeAnalysis::Text::SourceText ^ text, Microsoft::CodeAnalysis::Diagnostics::SourceTextValueProvider<TValue> ^ valueProvider, [Runtime::InteropServices::Out] TValue % value);
public bool TryGetValue<TValue> (Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.Diagnostics.SourceTextValueProvider<TValue> valueProvider, out TValue value);
member this.TryGetValue : Microsoft.CodeAnalysis.Text.SourceText * Microsoft.CodeAnalysis.Diagnostics.SourceTextValueProvider<'Value> * 'Value -> bool
Public Function TryGetValue(Of TValue) (text As SourceText, valueProvider As SourceTextValueProvider(Of TValue), ByRef value As TValue) As Boolean
Type Parameters
- TValue
The type of the value associated with the key.
Parameters
- text
- SourceText
SourceText for which the value is queried.
- valueProvider
- SourceTextValueProvider<TValue>
Provider that computes the underlying value.
- value
- TValue
Value associated with the key.
Returns
Returns true on success, false otherwise.