当前位置: 首页>>代码示例>>C#>>正文


C# ISet.ToArray方法代码示例

本文整理汇总了C#中ISet.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# ISet.ToArray方法的具体用法?C# ISet.ToArray怎么用?C# ISet.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISet的用法示例。


在下文中一共展示了ISet.ToArray方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GrammarData

        public GrammarData(Grammar grammar)
        {
            if (grammar == null)
                throw new ArgumentNullException(nameof(grammar));
            Grammar = grammar;

            AugmentedRoots =  new List<GrammarDefinition>();
            _allElements = new HashSet<GrammarElement>();
            GrammarReductionsMapping = new Dictionary<GrammarDefinition, List<GrammarReduction>>();
            AllReductions = new List<GrammarReduction>();

            foreach (var rootDefinition in grammar.RootDefinitions)
            {
                var augmentedRoot = new GrammarDefinition(rootDefinition.Name + "'", rootDefinition + Grammar.Eof);
                if (rootDefinition == grammar.DefaultRoot)
                    DefaultAugmentedRoot = augmentedRoot;
                AugmentedRoots.Add(augmentedRoot);
                AddReductions(augmentedRoot);
            }

            if(DefaultAugmentedRoot==null)
                throw new InvalidOperationException("Default root of grammar is not present in the root definitions collection.");

            AllElements = new ReadOnlyCollection<GrammarElement>(_allElements.ToArray());
        }
开发者ID:JerreS,项目名称:AbstractCode,代码行数:25,代码来源:GrammarData.cs

示例2: ImplicitExpressionEditHandler

        public ImplicitExpressionEditHandler(Func<string, IEnumerable<ISymbol>> tokenizer, ISet<string> keywords, bool acceptTrailingDot)
            : base(tokenizer)
        {
            _keywords = keywords ?? new HashSet<string>();

            // HashSet<T> implements IReadOnlyCollection<T> as of 4.6, but does not for 4.5.1. If the runtime cast
            // succeeds, avoid creating a new collection.
            _readOnlyKeywords = (_keywords as IReadOnlyCollection<string>) ?? _keywords.ToArray();

            AcceptTrailingDot = acceptTrailingDot;
        }
开发者ID:leloulight,项目名称:Razor,代码行数:11,代码来源:ImplicitExpressionEditHandler.cs

示例3: AdjacencyMatrixGraph

        public AdjacencyMatrixGraph(ISet<Vertex> V, ISet<Edge> E)
        {
            adjacency = new bool[V.Count, V.Count];
            vertices = V.ToArray();

            for (int i = 0; i < vertices.Length; i++)
            {
                indices[vertices[i]] = i;
            }

            foreach (Edge e in E)
            {
                adjacency[indices[e.u], indices[e.v]] = true;
            }
        }
开发者ID:Eyas,项目名称:Algorithms-CSharp,代码行数:15,代码来源:AdjacencyMatrixGraph.cs

示例4: RequestAssetsAsync

            public override async Task<IList<ValueTuple<Checksum, object>>> RequestAssetsAsync(int sessionId, ISet<Checksum> checksums, CancellationToken callerCancellationToken)
            {
                // it should succeed as long as matching VS is alive
                // TODO: add logging mechanism using Logger

                // this can be called in two ways. 
                // 1. Connection to get asset is closed (the asset source we were using is disconnected - _assetChannelCancellationToken)
                //    if this asset source's channel is closed, service will move to next asset source to get the asset as long as callerCancellationToken
                //    is not cancelled
                //
                // 2. Request to required this asset has cancelled. (callerCancellationToken)
                using (var mergedCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(_owner.CancellationToken, callerCancellationToken))
                using (RoslynLogger.LogBlock(FunctionId.SnapshotService_RequestAssetAsync, GetRequestLogInfo, sessionId, checksums, mergedCancellationToken.Token))
                {
                    return await _owner.Rpc.InvokeAsync(WellKnownServiceHubServices.AssetService_RequestAssetAsync,
                        new object[] { sessionId, checksums.ToArray() },
                        (s, c) => ReadAssets(s, sessionId, checksums, c), mergedCancellationToken.Token).ConfigureAwait(false);
                }
            }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:19,代码来源:SnapshotService.JsonRpcAssetSource.cs

示例5: NewInheritanceDialog

        internal NewInheritanceDialog(ConceptualEntityType baseType, IEnumerable<ConceptualEntityType> entityTypes)
        {
            InitializeComponent();
            // Set the default font to VS shell font.
            var vsFont = VSHelpers.GetVSFont(Services.ServiceProvider);
            if (vsFont != null)
            {
                Font = vsFont;
            }

            _entityTypes = new SortedSet<ConceptualEntityType>(new EFNameableItemComparer());

            foreach (var et in entityTypes)
            {
                _entityTypes.Add(et);
            }

            baseEntityComboBox.Items.AddRange(_entityTypes.ToArray());
            if (baseType != null)
            {
                baseEntityComboBox.SelectedItem = baseType;
            }
            CheckOkButtonEnabled();
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:24,代码来源:NewInheritanceDialog.cs

示例6: GenerateClassHierarchy

        public static void GenerateClassHierarchy(ISet<string> clrDlls)
        {
            using (LOGGER.LogFunction("ClrHandlerHelper::GenerateClassHierarchy"))
            {
                IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(clrDlls.ToArray());
                ProtocolBufferClassHierarchy.Serialize(Constants.ClassHierarachyBin, ns);

                LOGGER.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Class hierarchy written to [{0}].", Path.Combine(Directory.GetCurrentDirectory(), Constants.ClassHierarachyBin)));
            }
        }
开发者ID:kijungs,项目名称:incubator-reef,代码行数:10,代码来源:ClrHandlerHelper.cs

示例7: GetClosure

        private ISet<LR0Item> GetClosure(ISet<LR0Item> initSet)
        {
            bool isChanged;

            do
            {
                isChanged = false;
                foreach (var item in initSet.ToArray())
                {
                    isChanged = m_infoManager.Productions[item.ProductionIndex].Accept(m_closureVisitor, new ClosureInfo(item.DotLocation, isChanged, initSet));
                }
            } while (isChanged);

            return initSet;
        }
开发者ID:destinyclown,项目名称:VBF,代码行数:15,代码来源:LR0Model.cs

示例8: GetOrderRelationships

		/// <summary>
		///   Gets the activation order relationships that exist for the faults contained in
		///   <paramref name="minimalCriticalFaultSet" />, if any.
		/// </summary>
		/// <param name="minimalCriticalFaultSet">The minimal critical fault set the order should be returned for.</param>
		private IEnumerable<OrderRelationship> GetOrderRelationships(ISet<Fault> minimalCriticalFaultSet)
		{
			var checkedSet = new FaultSet(minimalCriticalFaultSet);
			var activation = _results.FaultActivationBehavior == FaultActivationBehavior.ForceOnly ? Activation.Forced : Activation.Nondeterministic;
			var checkedFaults = minimalCriticalFaultSet.ToArray();

			// Create all pairs of faults contained in minimalCriticalFaultSet such that
			// we don't get pairs (f,f) and we don't generate duplicate pairs (f1,f2) and (f2,f1)
			for (var i = 0; i < checkedFaults.Length; ++i)
			{
				for (var j = i + 1; j < checkedFaults.Length; ++j)
				{
					var fault1 = checkedFaults[i];
					var fault2 = checkedFaults[j];

					// Check if one can be activated strictly before the other
					var fault1BeforeFault2 = _backend.CheckOrder(fault1, fault2, checkedSet, activation, forceSimultaneous: false);
					var fault2BeforeFault1 = _backend.CheckOrder(fault2, fault1, checkedSet, activation, forceSimultaneous: false);

					// If both can be activated stritly before the other, there is no ordering
					if (!fault2BeforeFault1.FormulaHolds && !fault1BeforeFault2.FormulaHolds)
						continue;

					// Check for simultaneous activations
					var simultaneous = _backend.CheckOrder(fault1, fault2, checkedSet, activation, forceSimultaneous: true);

					// f1 == f2
					if (!simultaneous.FormulaHolds && fault1BeforeFault2.FormulaHolds && fault2BeforeFault1.FormulaHolds)
						yield return new OrderRelationship(simultaneous, fault1, fault2, OrderRelationshipKind.Simultaneously);

					// f1 <= f2
					else if (!fault1BeforeFault2.FormulaHolds && !simultaneous.FormulaHolds)
						yield return new OrderRelationship(simultaneous, fault1, fault2, OrderRelationshipKind.Precedes);

					// f1 < f2
					else if (!fault1BeforeFault2.FormulaHolds && simultaneous.FormulaHolds)
						yield return new OrderRelationship(simultaneous, fault1, fault2, OrderRelationshipKind.StrictlyPrecedes);

					// f2 <= f1
					else if (!fault2BeforeFault1.FormulaHolds && !simultaneous.FormulaHolds)
						yield return new OrderRelationship(simultaneous, fault2, fault1, OrderRelationshipKind.Precedes);

					// f2 < f1
					else if (!fault2BeforeFault1.FormulaHolds && simultaneous.FormulaHolds)
						yield return new OrderRelationship(simultaneous, fault2, fault1, OrderRelationshipKind.StrictlyPrecedes);
				}
			}
		}
开发者ID:isse-augsburg,项目名称:ssharp,代码行数:53,代码来源:OrderAnalysis.cs


注:本文中的ISet.ToArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。