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


C# IList.SequenceEqual方法代码示例

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


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

示例1: performTheExperiment

 private static IList<int> performTheExperiment(IList<int> xs)
 {
     var xs2 = xs.ToObservable().StartWith(0).Concat(Observable.Return(0))
     .Buffer(3, 1)
     .Where(l => l.Count == 3)
     .Select(l => changeSize(l[0], l[1], l[2]))
     .ToList()
     .First();
       if (xs.SequenceEqual(xs2))
     return xs;
       return performTheExperiment(xs2);
 }
开发者ID:pudae,项目名称:lplpl,代码行数:12,代码来源:645.cs

示例2: GetIndices

        public IEnumerable<ISonesIndex> GetIndices(IVertexType myVertexType, IList<IPropertyDefinition> myPropertyDefinition, SecurityToken mySecurityToken, Int64 myTransactionToken)
        {
            myVertexType.CheckNull("myVertexType");
            myPropertyDefinition.CheckNull("myPropertyDefinition");

            if (myPropertyDefinition.Count == 0)
                throw new ArgumentOutOfRangeException("myPropertyDefinition", "At least one property must be given.");

            var propertyTypes = myPropertyDefinition.GroupBy(_ => _.RelatedType);
            foreach (var group in propertyTypes)
            {
                if (!myVertexType.IsDescendantOrSelf(group.Key))
                {
                    throw new ArgumentException(string.Format("The properties ({0}) defined on type {1} is not part of inheritance hierarchy of {2}.",
                        string.Join(",", group.Select(_ => _.Name)),
                        group.Key.Name,
                        myVertexType.Name));
                }
            }

            var result = myVertexType.GetIndexDefinitions(false).Where(_ => myPropertyDefinition.SequenceEqual(_.IndexedProperties)).Select(_=>_indices[_.ID]).ToArray();

            return result;
        }
开发者ID:cosh,项目名称:sones,代码行数:24,代码来源:IndexManager.cs

示例3: Resolve

		public static IMember Resolve(ITypeResolveContext context,
		                              EntityType entityType,
		                              string name,
		                              ITypeReference explicitInterfaceTypeReference = null,
		                              IList<string> typeParameterNames = null,
		                              IList<ITypeReference> parameterTypeReferences = null)
		{
			if (context.CurrentTypeDefinition == null)
				return null;
			if (parameterTypeReferences == null)
				parameterTypeReferences = EmptyList<ITypeReference>.Instance;
			if (typeParameterNames == null || typeParameterNames.Count == 0) {
				// non-generic member
				// In this case, we can simply resolve the parameter types in the given context
				var parameterTypes = parameterTypeReferences.Resolve(context);
				if (explicitInterfaceTypeReference == null) {
					foreach (IMember member in context.CurrentTypeDefinition.Members) {
						if (member.IsExplicitInterfaceImplementation)
							continue;
						if (IsNonGenericMatch(member, entityType, name, parameterTypes))
							return member;
					}
				} else {
					IType explicitInterfaceType = explicitInterfaceTypeReference.Resolve(context);
					foreach (IMember member in context.CurrentTypeDefinition.Members) {
						if (!member.IsExplicitInterfaceImplementation)
							continue;
						if (member.ImplementedInterfaceMembers.Count != 1)
							continue;
						if (IsNonGenericMatch(member, entityType, name, parameterTypes)) {
							if (explicitInterfaceType.Equals(member.ImplementedInterfaceMembers[0].DeclaringType))
								return member;
						}
					}
				}
			} else {
				// generic member
				// In this case, we must specify the correct context for resolving the parameter types
				foreach (IMethod method in context.CurrentTypeDefinition.Methods) {
					if (method.EntityType != entityType)
						continue;
					if (method.Name != name)
						continue;
					if (method.Parameters.Count != parameterTypeReferences.Count)
						continue;
					// Compare type parameter count and names:
					if (!typeParameterNames.SequenceEqual(method.TypeParameters.Select(tp => tp.Name)))
						continue;
					// Once we know the type parameter names are fitting, we can resolve the
					// type references in the context of the method:
					var contextForMethod = context.WithCurrentMember(method);
					var parameterTypes = parameterTypeReferences.Resolve(contextForMethod);
					if (!IsParameterTypeMatch(method, parameterTypes))
						continue;
					if (explicitInterfaceTypeReference == null) {
						if (!method.IsExplicitInterfaceImplementation)
							return method;
					} else if (method.IsExplicitInterfaceImplementation && method.ImplementedInterfaceMembers.Count == 1) {
						IType explicitInterfaceType = explicitInterfaceTypeReference.Resolve(contextForMethod);
						if (explicitInterfaceType.Equals(method.ImplementedInterfaceMembers[0].DeclaringType))
							return method;
					}
				}
			}
			return null;
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:66,代码来源:AbstractUnresolvedMember.cs

示例4: CompareRecommendedActionLinkedObjects

        /// <summary>
        /// Comapres linked Objects details of recommendation action entity
        /// </summary>
        private static void CompareRecommendedActionLinkedObjects(IList<string> expected, IEnumerable<string> response)
        {
            Assert.False(expected != null ^ response != null);

            if (response != null)
            {
                Assert.True(expected.SequenceEqual(response));
            }
        }
开发者ID:bganapa,项目名称:azure-sdk-for-net,代码行数:12,代码来源:Sql2.RecommendedActionScenarioTest.cs

示例5: HaveSameSignature

        public bool HaveSameSignature(
            IList<IParameterSymbol> parameters1,
            IList<IParameterSymbol> parameters2)
        {
            if (parameters1.Count != parameters2.Count)
            {
                return false;
            }

            return parameters1.SequenceEqual(parameters2, this.ParameterEquivalenceComparer);
        }
开发者ID:riversky,项目名称:roslyn,代码行数:11,代码来源:SignatureComparer.cs

示例6: SaveWs

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Save the new list of writing systems to the database
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected void SaveWs(CheckedListBox lstBox, IList<IWritingSystem> currList, ICollection<IWritingSystem> allSet)
		{
			if (allSet.Count != lstBox.Items.Count || allSet.Intersect(lstBox.Items.Cast<IWritingSystem>()).Count() != allSet.Count)
			{
				var newWsIds = new List<string>();
				foreach (IWritingSystem ws in lstBox.Items)
				{
					string id = ws.IcuLocale;
					if (allSet.FirstOrDefault(existing => existing.IcuLocale == id) == null)
						newWsIds.Add(id);
				}
				allSet.Clear();
				foreach (IWritingSystem ws in lstBox.Items)
				{
					if (ws.Handle == 0)
						m_cache.ServiceLocator.WritingSystemManager.Replace(ws);
					allSet.Add(ws);
				}
				m_fWsChanged = true;
				foreach (var newWs in newWsIds)
				{
					// IcuLocale uses _ to separate, RFC5646 uses -.  We need the latter (see FWNX-1165).
					ProgressDialogWithTask.ImportTranslatedListsForWs(this, m_cache, newWs.Replace("_","-"));
				}
			}

			if (!currList.SequenceEqual(lstBox.CheckedItems.Cast<IWritingSystem>()))
			{
				currList.Clear();
				foreach (IWritingSystem ws in lstBox.CheckedItems)
					currList.Add(ws);
				m_fWsChanged = true;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:39,代码来源:FwProjPropertiesDlg.cs

示例7: WsListChanged

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Save the new list of writing systems to the database
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected bool WsListChanged(CheckedListBox lstBox, IList<IWritingSystem> currList, ICollection<IWritingSystem> allSet)
		{
			if (allSet.Count != lstBox.Items.Count || allSet.Intersect(lstBox.Items.Cast<IWritingSystem>()).Count() != allSet.Count)
			{
				return true;
			}

			if (!currList.SequenceEqual(lstBox.CheckedItems.Cast<IWritingSystem>()))
			{
				return true;
			}
			return false;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:18,代码来源:FwProjPropertiesDlg.cs

示例8: assertNonLLStar

        protected void assertNonLLStar( Grammar g, IList<int> expectedBadAlts )
        {
            DecisionProbe.verbose = true; // make sure we get all error info
            ErrorQueue equeue = new ErrorQueue();
            ErrorManager.SetErrorListener( equeue );

            // mimic actions of org.antlr.Tool first time for grammar g
            if ( g.NumberOfDecisions == 0 )
            {
                g.BuildNFA();
                g.CreateLookaheadDFAs( false );
            }
            NonRegularDecisionMessage msg = getNonRegularDecisionMessage( equeue.errors );
            Assert.IsNotNull(msg, "expected fatal non-LL(*) msg");
            List<int> alts = new List<int>();
            alts.AddRange( msg.altsWithRecursion );
            alts.Sort();
            //Collections.sort( alts );
            //Assert.AreEqual( expectedBadAlts, alts );
            Assert.IsTrue( expectedBadAlts.SequenceEqual( alts ) );
        }
开发者ID:JSchofield,项目名称:antlrcs,代码行数:21,代码来源:TestDFAConversion.cs

示例9: Write

 private void Write(IList<int> trueOutput, IList<int> output, ref int correct)
 {
     if (output.SequenceEqual(trueOutput))
     {
         correct++;
         Console.Write("+\t");
     }
     else
         Console.Write("-\t");
     foreach (var element in trueOutput)
     {
         Console.Write(element);
     }
     Console.Write("\t");
     foreach (var element in output)
     {
         Console.Write(element);
     }
     Console.WriteLine();
 }
开发者ID:MislavMandaric,项目名称:genetic-neural-network,代码行数:20,代码来源:NeuralNetwork.cs


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