本文整理汇总了C#中ImmutableArray.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# ImmutableArray.AddRange方法的具体用法?C# ImmutableArray.AddRange怎么用?C# ImmutableArray.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImmutableArray
的用法示例。
在下文中一共展示了ImmutableArray.AddRange方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendDiagnostics
protected virtual void AppendDiagnostics(IEnumerable<DiagnosticData> items)
{
_builder = _builder ?? ImmutableArray.CreateBuilder<DiagnosticData>();
_builder.AddRange(items);
}
示例2: ProcessStarting
/// <summary>
/// Invoked by <see cref="InteractiveHost"/> when a new process is being started.
/// </summary>
private void ProcessStarting(bool initialize)
{
var textView = GetCurrentWindowOrThrow().TextView;
var dispatcher = ((FrameworkElement)textView).Dispatcher;
if (!dispatcher.CheckAccess())
{
dispatcher.BeginInvoke(new Action(() => ProcessStarting(initialize)));
return;
}
// Freeze all existing classifications and then clear the list of submission buffers we have.
_submissionBuffers.Remove(_currentSubmissionBuffer); // if present
foreach (var textBuffer in _submissionBuffers)
{
InertClassifierProvider.CaptureExistingClassificationSpans(_classifierAggregator, textView, textBuffer);
}
_submissionBuffers.Clear();
// We always start out empty
_workspace.ClearSolution();
_currentSubmissionProjectId = null;
_previousSubmissionProjectId = null;
var metadataService = _workspace.CurrentSolution.Services.MetadataService;
var mscorlibRef = metadataService.GetReference(typeof(object).Assembly.Location, MetadataReferenceProperties.Assembly);
var interactiveHostObjectRef = metadataService.GetReference(typeof(InteractiveScriptGlobals).Assembly.Location, Script.HostAssemblyReferenceProperties);
_responseFileReferences = ImmutableArray.Create<MetadataReference>(mscorlibRef, interactiveHostObjectRef);
_responseFileImports = ImmutableArray<string>.Empty;
_initialScriptFileOpt = null;
ReferenceSearchPaths = ImmutableArray<string>.Empty;
SourceSearchPaths = ImmutableArray<string>.Empty;
if (initialize && File.Exists(_responseFilePath))
{
// The base directory for relative paths is the directory that contains the .rsp file.
// Note that .rsp files included by this .rsp file will share the base directory (Dev10 behavior of csc/vbc).
var responseFileDirectory = Path.GetDirectoryName(_responseFilePath);
var args = this.CommandLineParser.Parse(new[] { "@" + _responseFilePath }, responseFileDirectory, RuntimeEnvironment.GetRuntimeDirectory(), null);
if (args.Errors.Length == 0)
{
var metadataResolver = CreateMetadataReferenceResolver(metadataService, args.ReferencePaths, responseFileDirectory);
var sourceResolver = CreateSourceReferenceResolver(args.SourcePaths, responseFileDirectory);
// ignore unresolved references, they will be reported in the interactive window:
var responseFileReferences = args.ResolveMetadataReferences(metadataResolver).Where(r => !(r is UnresolvedMetadataReference));
_initialScriptFileOpt = args.SourceFiles.IsEmpty ? null : args.SourceFiles[0].Path;
ReferenceSearchPaths = args.ReferencePaths;
SourceSearchPaths = args.SourcePaths;
_responseFileReferences = _responseFileReferences.AddRange(responseFileReferences);
_responseFileImports = CommandLineHelpers.GetImports(args);
}
}
_metadataReferenceResolver = CreateMetadataReferenceResolver(metadataService, ReferenceSearchPaths, _initialWorkingDirectory);
_sourceReferenceResolver = CreateSourceReferenceResolver(SourceSearchPaths, _initialWorkingDirectory);
// create the first submission project in the workspace after reset:
if (_currentSubmissionBuffer != null)
{
AddSubmission(_currentSubmissionBuffer, this.LanguageName);
}
}
示例3: AddNonLocalDiagnostics
private static void AddNonLocalDiagnostics(
ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> nonLocalDiagnostics,
ImmutableHashSet<DiagnosticAnalyzer> excludedAnalyzers,
ImmutableArray<Diagnostic>.Builder builder)
{
foreach (var diagnosticsByAnalyzer in nonLocalDiagnostics)
{
if (excludedAnalyzers.Contains(diagnosticsByAnalyzer.Key))
{
continue;
}
builder.AddRange(diagnosticsByAnalyzer.Value);
}
}
示例4: AddDiagnostics_NoLock
private static void AddDiagnostics_NoLock(
Dictionary<DiagnosticAnalyzer, List<Diagnostic>> diagnostics,
AnalysisScope analysisScope,
ImmutableArray<Diagnostic>.Builder builder)
{
Debug.Assert(diagnostics != null);
foreach (var analyzer in analysisScope.Analyzers)
{
List<Diagnostic> diagnosticsByAnalyzer;
if (diagnostics.TryGetValue(analyzer, out diagnosticsByAnalyzer))
{
builder.AddRange(diagnosticsByAnalyzer);
}
}
}
示例5: ShouldTryAgainWithMoreMetadataBlocks
/// <remarks>
/// Internal for testing.
/// </remarks>
internal static bool ShouldTryAgainWithMoreMetadataBlocks(DkmUtilities.GetMetadataBytesPtrFunction getMetaDataBytesPtrFunction, ImmutableArray<AssemblyIdentity> missingAssemblyIdentities, ref ImmutableArray<MetadataBlock> references)
{
var newReferences = DkmUtilities.GetMetadataBlocks(getMetaDataBytesPtrFunction, missingAssemblyIdentities);
if (newReferences.Length > 0)
{
references = references.AddRange(newReferences);
return true;
}
return false;
}