本文整理汇总了C#中IEnumerable.ToImmutableArray方法的典型用法代码示例。如果您正苦于以下问题:C# IEnumerable.ToImmutableArray方法的具体用法?C# IEnumerable.ToImmutableArray怎么用?C# IEnumerable.ToImmutableArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnumerable
的用法示例。
在下文中一共展示了IEnumerable.ToImmutableArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompletionModel
public CompletionModel(SemanticModel semanticModel, TextSpan applicableSpan, ITextSnapshot textSnapshot, IEnumerable<CompletionItem> items)
{
SemanticModel = semanticModel;
ApplicableSpan = applicableSpan;
TextSnapshot = textSnapshot;
Items = items.ToImmutableArray();
}
示例2: RepoConfig
internal RepoConfig(
IEnumerable<NuGetPackage> fixedPackages,
IEnumerable<string> toolsetPackages,
IEnumerable<Regex> nuspecExcludes,
IEnumerable<Regex> projectJsonExcludes,
GenerateData? msbuildGenerateData)
{
Debug.Assert(toolsetPackages.Distinct().Count() == toolsetPackages.Count());
MSBuildGenerateData = msbuildGenerateData;
FixedPackages = fixedPackages.OrderBy(x => x.Name).ToImmutableArray();
NuSpecExcludes = nuspecExcludes.ToImmutableArray();
ProjectJsonExcludes = projectJsonExcludes.ToImmutableArray();
ToolsetPackages = toolsetPackages.OrderBy(x => x).ToImmutableArray();
var map = new Dictionary<string, List<string>>();
foreach (var nugetRef in fixedPackages)
{
List<string> list;
if (!map.TryGetValue(nugetRef.Name, out list))
{
list = new List<string>(capacity: 1);
map[nugetRef.Name] = list;
}
list.Add(nugetRef.Version);
}
}
示例3: ParsingResult
public ParsingResult(Settings settings,
ITextSnapshot textSnapshot,
IEnumerable<TextSpan> attributeSpans)
{
TextSnapshot = textSnapshot;
AttributeSpans = attributeSpans.ToImmutableArray();
}
示例4: SimpleDiagnostic
private SimpleDiagnostic(
DiagnosticDescriptor descriptor,
DiagnosticSeverity severity,
int warningLevel,
Location location,
IEnumerable<Location> additionalLocations,
object[] messageArgs)
{
if ((warningLevel == 0 && severity != DiagnosticSeverity.Error) ||
(warningLevel != 0 && severity == DiagnosticSeverity.Error))
{
throw new ArgumentException(nameof(warningLevel));
}
if(descriptor == null)
{
throw new ArgumentNullException(nameof(descriptor));
}
_descriptor = descriptor;
_severity = severity;
_warningLevel = warningLevel;
_location = location ?? Location.None;
_additionalLocations = additionalLocations == null ? SpecializedCollections.EmptyReadOnlyList<Location>() : additionalLocations.ToImmutableArray();
_messageArgs = messageArgs ?? SpecializedCollections.EmptyArray<object>();
}
示例5: SignatureHelpModel
public SignatureHelpModel(TextSpan applicableSpan, IEnumerable<SignatureItem> signatures, SignatureItem signature, int selectedParameter)
{
Signatures = signatures.ToImmutableArray();
ApplicableSpan = applicableSpan;
Signature = signature;
SelectedParameter = selectedParameter;
}
示例6: RuleSet
/// <summary>
/// Create a RuleSet.
/// </summary>
public RuleSet(string filePath, ReportDiagnostic generalOption, IDictionary<string, ReportDiagnostic> specificOptions, IEnumerable<RuleSetInclude> includes)
{
this.filePath = filePath;
this.generalDiagnosticOption = generalOption;
this.specificDiagnosticOptions = specificOptions == null ? ImmutableDictionary<string, ReportDiagnostic>.Empty : specificOptions.ToImmutableDictionary();
this.includes = includes == null ? ImmutableArray<RuleSetInclude>.Empty : includes.ToImmutableArray();
}
示例7: SimpleDiagnostic
internal SimpleDiagnostic(string id, string category, string message, DiagnosticSeverity severity, bool isEnabledByDefault,
int warningLevel, bool isWarningAsError, Location location,
IEnumerable<Location> additionalLocations)
{
if (isWarningAsError && severity != DiagnosticSeverity.Warning)
{
throw new ArgumentException("isWarningAsError");
}
if ((warningLevel == 0 && severity == DiagnosticSeverity.Warning) ||
(warningLevel != 0 && severity != DiagnosticSeverity.Warning))
{
throw new ArgumentException("warningLevel");
}
this.id = id;
this.category = category;
this.message = message;
this.severity = severity;
this.isEnabledByDefault = isEnabledByDefault;
this.warningLevel = warningLevel;
this.isWarningAsError = isWarningAsError;
this.location = location;
this.additionalLocations = additionalLocations == null ? SpecializedCollections.EmptyReadOnlyList<Location>() : additionalLocations.ToImmutableArray();
}
示例8: ResolvedPropertyBinder
public ResolvedPropertyBinder(IEnumerable<PropertyAccessor> properties)
{
if (properties == null)
{
throw Logger.Fatal.ArgumentNull(nameof(properties));
}
Properties = properties.ToImmutableArray();
}
示例9: DefaultFromContextPropertyBinder
public DefaultFromContextPropertyBinder(IEnumerable<DefaultFromContextProperty> properties)
{
if (properties == null)
{
throw Logger.Fatal.ArgumentNull(nameof(properties));
}
Properties = properties.ToImmutableArray();
}
示例10: Update
public BoundFunctionInvocationExpression Update(IEnumerable<BoundExpression> arguments, OverloadResolutionResult<FunctionSymbolSignature> result)
{
var newArguments = arguments.ToImmutableArray();
if (newArguments == Arguments && result == Result)
return this;
return new BoundFunctionInvocationExpression(Syntax, newArguments, result);
}
示例11: CodeFixCollection
public CodeFixCollection(
object provider,
TextSpan span,
IEnumerable<CodeFix> fixes,
FixAllState fixAllState,
IEnumerable<FixAllScope> supportedScopes,
Diagnostic firstDiagnostic) :
this(provider, span, fixes.ToImmutableArray(), fixAllState, supportedScopes, firstDiagnostic)
{
}
示例12: EwfTableItemGroupRemainingData
/// <summary>
/// Creates a remaining data object.
/// </summary>
/// <param name="groupName">A control that contains the name of the group and any other information you want in the group head</param>
/// <param name="groupActions">Group action buttons</param>
/// <param name="groupHeadClickScript">The click script for the group head</param>
/// <param name="initiallyCollapsed">Whether the group is initially collapsed. Null means the group cannot be collapsed and is always visible.</param>
/// <param name="tailUpdateRegions">The tail update regions for the group. If a table uses item limiting, these regions will include all subsequent item
/// groups in the table. This is necessary because any number of items could be appended to this item group, potentially causing subsequent item groups to
/// become invisible.</param>
public EwfTableItemGroupRemainingData(
Control groupName, IEnumerable<Tuple<string, Action>> groupActions = null, ClickScript groupHeadClickScript = null, bool? initiallyCollapsed = null,
IEnumerable<TailUpdateRegion> tailUpdateRegions = null)
{
GroupName = groupName;
GroupActions = ( groupActions ?? new Tuple<string, Action>[ 0 ] ).ToList().AsReadOnly();
GroupHeadClickScript = groupHeadClickScript;
InitiallyCollapsed = initiallyCollapsed;
TailUpdateRegions = tailUpdateRegions != null ? tailUpdateRegions.ToImmutableArray() : ImmutableArray<TailUpdateRegion>.Empty;
}
示例13: CodeRefactoring
public CodeRefactoring(CodeRefactoringProvider provider, IEnumerable<CodeAction> actions)
{
_provider = provider;
_actions = actions.ToImmutableArray();
if (_actions.Count == 0)
{
throw new ArgumentException("Actions can not be empty", "actions");
}
}
示例14: TextChangeEventArgs
/// <summary>
/// Initializes an instance of <see cref="TextChangeEventArgs"/>.
/// </summary>
/// <param name="oldText">The text before the change.</param>
/// <param name="newText">The text after the change.</param>
/// <param name="changes">A non-empty set of ranges for the change.</param>
public TextChangeEventArgs(SourceText oldText, SourceText newText, IEnumerable<TextChangeRange> changes)
{
if (changes == null || changes.IsEmpty())
{
throw new ArgumentException("changes");
}
this.OldText = oldText;
this.NewText = newText;
this.Changes = changes.ToImmutableArray();
}
示例15: TestCaseViewModel
public TestCaseViewModel(string displayName, string skipReason, string assemblyFileName, IEnumerable<TraitViewModel> traits)
{
this.DisplayName = displayName;
this.SkipReason = skipReason;
this.AssemblyFileName = assemblyFileName;
this.Traits = traits.ToImmutableArray();
if (!string.IsNullOrEmpty(skipReason))
{
_state = TestState.Skipped;
}
}