本文整理汇总了C#中ImmutableList类的典型用法代码示例。如果您正苦于以下问题:C# ImmutableList类的具体用法?C# ImmutableList怎么用?C# ImmutableList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableList类属于命名空间,在下文中一共展示了ImmutableList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Solution
private Solution(
BranchId branchId,
int workspaceVersion,
SolutionServices solutionServices,
SolutionId id,
string filePath,
ImmutableList<ProjectId> projectIds,
ImmutableDictionary<ProjectId, ProjectState> idToProjectStateMap,
ImmutableDictionary<ProjectId, CompilationTracker> projectIdToTrackerMap,
ProjectDependencyGraph dependencyGraph,
VersionStamp version,
Lazy<VersionStamp> lazyLatestProjectVersion)
{
this.branchId = branchId;
this.workspaceVersion = workspaceVersion;
this.id = id;
this.filePath = filePath;
this.solutionServices = solutionServices;
this.projectIds = projectIds;
this.projectIdToProjectStateMap = idToProjectStateMap;
this.projectIdToTrackerMap = projectIdToTrackerMap;
this.dependencyGraph = dependencyGraph;
this.projectIdToProjectMap = ImmutableHashMap<ProjectId, Project>.Empty;
this.version = version;
this.lazyLatestProjectVersion = lazyLatestProjectVersion;
CheckInvariants();
}
开发者ID:riversky,项目名称:roslyn,代码行数:28,代码来源:Solution.cs
示例2: PathSpec
internal PathSpec(PathFlags flags, string directorySeparator, IEnumerable<string> elements)
{
ValidateFlags(flags);
Flags = flags;
DirectorySeparator = directorySeparator;
Components = elements.SelectMany(SplitComponent).ToImmutableList();
}
开发者ID:ApocalypticOctopus,项目名称:Apocalyptic.Utilities.Net,代码行数:7,代码来源:PathSpec.cs
示例3: FreeVariableNames
public override ImmutableList<char> FreeVariableNames(ImmutableList<Symbol> boundVariables)
{
if (boundVariables.Contains(_variable))
return ImmutableList<char>.Empty;
else
return new char[] { _variable.Default }.ToImmutableList();
}
开发者ID:michaellperry,项目名称:ClipboardCalculator,代码行数:7,代码来源:BoundVariable.cs
示例4: RecoursiveCheckGraph
private static bool RecoursiveCheckGraph(Task root, ImmutableList<Guid> previousTasks)
{
Contract.Requires(root != null);
Contract.Requires(root.Inputs != null);
Contract.Requires(previousTasks != null);
if (previousTasks.Contains(root.Id))
{
Logger.Write(
LogCategories.Error(string.Format(
"{0} is cycled.", root),
LogCategories.TaskServices));
return false;
}
foreach (var task in root.Inputs)
{
if (previousTasks.Contains(task.Id))
{
Logger.Write(
LogCategories.Error(string.Format(
"{0} is cycled.", task),
LogCategories.TaskServices));
return false;
}
if (!RecoursiveCheckGraph(task, previousTasks.Add(root.Id)))
return false;
}
return true;
}
开发者ID:kapitanov,项目名称:diploma,代码行数:31,代码来源:JobGraphCyclesValidationStrategy.cs
示例5: BenchmarkDiff
public BenchmarkDiff(BenchmarkRun left, BenchmarkRun right, ImmutableList<SourceLogEntry> log)
{
Left = left;
Right = right;
var leftResults = left.AllResults.ToList();
var rightResults = right.AllResults.ToList();
LeftOnly = leftResults.ExceptBy(rightResults, result => result.FullMethod);
RightOnly = rightResults.ExceptBy(leftResults, result => result.FullMethod);
var pairs = (from l in leftResults
join r in rightResults on l.FullMethod equals r.FullMethod
select new BenchmarkPair(l, r)).ToList();
LeftBetter = pairs.Where(pair => pair.Percent < ImprovementThreshold).ToList();
RightBetter = pairs.Where(pair => pair.Percent > RegressionThreshold).ToList();
bool leftEarlier = BenchmarkRepository.BuildForLabel(left.Label) < BenchmarkRepository.BuildForLabel(right.Label);
var earlier = leftEarlier ? left : right;
var later = leftEarlier ? right : left;
var earlierHash = BenchmarkRepository.HashForLabel(earlier.Label);
var laterHash = BenchmarkRepository.HashForLabel(later.Label);
LogEntries = log.EntriesBetween(earlierHash, laterHash).ToList();
}
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:26,代码来源:BenchmarkDiff.cs
示例6: MainForm
public MainForm()
{
InitializeComponent();
cmv = new CMV();
rawframes = new List<CMVFrame>();
cmvframes = new ImmutableList<CMVFrame>(rawframes, "empty");
copybuffer = new List<CMVFrame>();
foregroundColourPicker.Colors = CMVColours.ForegroundColors;
backgroundColourPicker.Colors = CMVColours.BackgroundColors;
updateDelayTimer = new Timer();
updateDelayTimer.Interval = 24;
updateDelayTimer.Tick += handleUpdateDelayTimer;
aboutBox = new AboutBox();
aboutBox.HelpButtonClicked += new EventHandler(action_HelpTopics);
newFileDialog = new ChooseDimensionsBox();
loadTileset();
RefreshControls();
}
开发者ID:billylegota,项目名称:CMV-Editor,代码行数:25,代码来源:MainForm.cs
示例7: CompilationDocument
// --- Initialization ---
/// <summary>
/// Initializes a new compilation document from a list of text lines.
/// This method does not scan the inserted text lines to produce tokens.
/// You must explicitely call UpdateTokensLines() to start an initial scan of the document.
/// </summary>
public CompilationDocument(TextSourceInfo textSourceInfo, IEnumerable<ITextLine> initialTextLines, TypeCobolOptions compilerOptions, IProcessedTokensDocumentProvider processedTokensDocumentProvider)
{
TextSourceInfo = textSourceInfo;
CompilerOptions = compilerOptions;
this.processedTokensDocumentProvider = processedTokensDocumentProvider;
// Initialize the compilation document lines
compilationDocumentLines = ImmutableList<CodeElementsLine>.Empty.ToBuilder();
// ... with the initial list of text lines received as a parameter
if (initialTextLines != null)
{
// Insert Cobol text lines in the internal tree structure
compilationDocumentLines.AddRange(initialTextLines.Select(textLine => CreateNewDocumentLine(textLine, textSourceInfo.ColumnsLayout)));
}
// Initialize document views versions
currentTextLinesVersion = new DocumentVersion<ICobolTextLine>(this);
currentTokensLinesVersion = new DocumentVersion<ITokensLine>(this);
// Initialize performance stats
PerfStatsForText = new PerfStatsForCompilationStep(CompilationStep.Text);
PerfStatsForScanner = new PerfStatsForCompilationStep(CompilationStep.Scanner);
PerfStatsForPreprocessor = new PerfStatsForCompilationStep(CompilationStep.Preprocessor);
}
开发者ID:laurentprudhon,项目名称:TypeCobol,代码行数:31,代码来源:CompilationDocument.cs
示例8: Prebuild
/// <summary>
/// 1. Expand the TOC reference
/// 2. Resolve homepage
/// </summary>
/// <param name="models"></param>
/// <param name="host"></param>
/// <returns></returns>
public override IEnumerable<FileModel> Prebuild(ImmutableList<FileModel> models, IHostService host)
{
var tocModelCache = new Dictionary<string, TocItemInfo>();
foreach (var model in models)
{
if (!tocModelCache.ContainsKey(model.OriginalFileAndType.FullPath))
{
tocModelCache[model.OriginalFileAndType.FullPath] = new TocItemInfo(model.OriginalFileAndType, (TocItemViewModel)model.Content);
}
}
var tocResolver = new TocResolver(host, tocModelCache);
foreach (var key in tocModelCache.Keys.ToList())
{
tocModelCache[key] = tocResolver.Resolve(key);
}
foreach (var model in models)
{
var wrapper = tocModelCache[model.OriginalFileAndType.FullPath];
// If the TOC file is referenced by other TOC, remove it from the collection
if (!wrapper.IsReferenceToc)
{
model.Content = wrapper.Content;
yield return model;
}
}
}
开发者ID:vicancy,项目名称:docfx,代码行数:35,代码来源:BuildTocDocument.cs
示例9: FakeHeaders
public FakeHeaders()
{
this.blockHeaders = ImmutableList.CreateBuilder<ChainedHeader>();
this.bits = DataCalculator.TargetToBits(UnitTestRules.Target0);
this.nonce = (UInt32)Interlocked.Increment(ref staticNonce);
this.totalWork = 0;
}
开发者ID:ArsenShnurkov,项目名称:BitSharp,代码行数:7,代码来源:FakeHeaders.cs
示例10: FakeHeaders
public FakeHeaders(IEnumerable<ChainedHeader> blockHeaders)
{
this.blockHeaders = ImmutableList.CreateRange(blockHeaders).ToBuilder();
this.bits = DataCalculator.ToCompact(UnitTestParams.Target0);
this.nonce = (UInt32)Interlocked.Increment(ref staticNonce);
this.totalWork = blockHeaders.LastOrDefault()?.TotalWork ?? 0;
}
开发者ID:pmlyon,项目名称:BitSharp,代码行数:7,代码来源:FakeHeaders.cs
示例11: Animator
public static Animator CreateAnimator
(this ImmutableList<IAnimationSection> animationSections,
ImmutableList<IRenderer> children)
{
return new Animator(animationSections, children);
}
开发者ID:Weingartner,项目名称:SolidworksAddinFramework,代码行数:7,代码来源:AnimationExtensions.cs
示例12: ApplyOverrides
private void ApplyOverrides(ImmutableList<FileModel> models, IHostService host)
{
foreach (var uid in host.GetAllUids())
{
var ms = host.LookupByUid(uid);
var od = ms.SingleOrDefault(m => m.Type == DocumentType.Override);
if (od != null)
{
var ovm = ((List<ItemViewModel>)od.Content).Single(vm => vm.Uid == uid);
foreach (
var pair in
from model in ms
where model.Type == DocumentType.Article
from item in ((PageViewModel)model.Content).Items
where item.Uid == uid
select new { model, item })
{
var vm = pair.item;
// todo : fix file path
Merger.Merge(ref vm, ovm);
((HashSet<string>)pair.model.Properties.LinkToUids).UnionWith((HashSet<string>)od.Properties.LinkToUids);
((HashSet<string>)pair.model.Properties.LinkToFiles).UnionWith((HashSet<string>)od.Properties.LinkToFiles);
}
}
}
}
开发者ID:yodamaster,项目名称:docfx,代码行数:26,代码来源:ApplyOverrideDocument.cs
示例13: CompanyState
public CompanyState(Company company, int money, int loans, ImmutableList<Train> trains)
{
Company = company;
Money = money;
Loans = loans;
Trains = trains;
}
开发者ID:paulbatum,项目名称:18xx,代码行数:7,代码来源:Company.cs
示例14: PrivateAuctionRound
private PrivateAuctionRound(ImmutableList<Player> players, ImmutableList<PrivateCompany> privates, Auction<PrivateCompany> auction, Player activePlayer, Player lastToAct, int seedMoney)
: base(players, activePlayer, lastToAct)
{
Privates = privates;
CurrentAuction = auction;
SeedMoney = seedMoney;
}
开发者ID:paulbatum,项目名称:18xx,代码行数:7,代码来源:PrivateAuctionRound.cs
示例15: Main
public static void Main()
{
var list = new List<ClassWithStringProperty>() { "test1", "test2", "test3", "test4"};
var imlist = new ImmutableList<ClassWithStringProperty>(list);
Console.WriteLine("Lists created:");
Console.WriteLine(list.Stringify(e =>e.Prop));
Console.WriteLine(imlist.Stringify(e => e.Prop));
Console.WriteLine("Mutable list modified[immutable not modified]:");
list.Add("test5");
Console.WriteLine(list.Stringify(e => e.Prop));
Console.WriteLine(imlist.Stringify(e => e.Prop));
Console.WriteLine("Element in immutable changed[not really...]:");
var elem = imlist[2];
elem.Prop = "1234";
Console.WriteLine(imlist.Stringify(e => e.Prop));
Console.WriteLine("Element in mutable changed[& not in immutable]:");
elem = list[2];
elem.Prop = "12387";
Console.WriteLine(list.Stringify(e => e.Prop));
Console.WriteLine(imlist.Stringify(e => e.Prop));
Console.ReadLine();
}
开发者ID:lemmit,项目名称:DesignPatternsUsingImmutableClasses,代码行数:26,代码来源:Program.cs
示例16: EnumeratorLengthTest1
public void EnumeratorLengthTest1()
{
var list1 = new ImmutableList<int>(new int[] { 0, 1, 2 });
var list2 = new ImmutableList<int>(new int[] { 3, 4, 5 });
var list = list1.Concat(list2);
Assert.True(list.Length == 6);
list = list.Tail();
Assert.True(list.Length == 5);
list = list.Tail();
list = list.Tail();
list = list.Tail();
list = list.Tail();
Assert.True(list.Length == 1);
Assert.True(list.IsAlmostEmpty);
list = list.Tail();
Assert.True(list.IsEmpty);
Assert.Throws<ParserException>(() => list.Tail());
}
开发者ID:ApocalypticOctopus,项目名称:csharp-monad,代码行数:25,代码来源:ImmutableListTests.cs
示例17: NavigationItem
public NavigationItem(string displayName, int imageIndex, [CanBeNull] Location location, int navigationPoint, ImmutableList<NavigationItem> children=null) {
Extent = location?.Extent;
NavigationPoint = navigationPoint;
DisplayName = displayName;
ImageIndex = imageIndex;
Children = children?? ImmutableList<NavigationItem>.Empty;
}
开发者ID:IInspectable,项目名称:Nav.Language.Extensions,代码行数:7,代码来源:NavigationItem.cs
示例18: MakeMouseClick
public static Order MakeMouseClick(ImmutableList<UInt16> selected, Vector point) {
return new Order() {
OrderType = 1,
SelectedUnits = selected,
PreparedOrderPoint = point
};
}
开发者ID:hot1989hot,项目名称:nora,代码行数:7,代码来源:Order.cs
示例19: VisualStudioDocumentTrackingService
public VisualStudioDocumentTrackingService(IServiceProvider serviceProvider)
{
_visibleFrames = ImmutableList<FrameListener>.Empty;
_monitorSelection = (IVsMonitorSelection)serviceProvider.GetService(typeof(SVsShellMonitorSelection));
_monitorSelection.AdviseSelectionEvents(this, out _cookie);
}
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:7,代码来源:VisualStudioDocumentTrackingService.cs
示例20: OnLoad
protected override void OnLoad(EventArgs e)
{
base.OnLoad (e);
String version = GL.GetString(StringName.Version);
Console.WriteLine("GL version: " + version);
context = GLGraphics.NewContext(Context, true);
program = context.NewProgramFromFiles("Render.vert", "Render.frag");
texture0 = context.NewTexture(TextureMinFilter.Nearest, TextureMagFilter.Nearest, TextureWrapMode.Clamp, TextureWrapMode.Clamp);
texture0.UploadImage(sourceImage);
sourceImage.Dispose();
texture1 = context.NewTexture(TextureMinFilter.Nearest, TextureMagFilter.Nearest, TextureWrapMode.Clamp, TextureWrapMode.Clamp);
texture1.UploadImage(new byte[4 * 4 * 4], 4, 4, PixelInternalFormat.Four, PixelFormat.Rgba, PixelType.UnsignedByte);
CreateAndFillBuffers();
paramSpec = ImmutableList<Tuple<String, Object>>.List(new Tuple<String, Object>[] {
Tuple.Create<String, Object>("a_position", positions),
Tuple.Create<String, Object>("a_texPos", textureCoords),
Tuple.Create<String, Object>("u_texture0", texture0),
Tuple.Create<String, Object>("u_texture1", texture1)});
}
开发者ID:phile314,项目名称:libPi,代码行数:25,代码来源:TestWindow.cs
注:本文中的ImmutableList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论