本文整理汇总了C#中IEnumerable.SequenceEqual方法的典型用法代码示例。如果您正苦于以下问题:C# IEnumerable.SequenceEqual方法的具体用法?C# IEnumerable.SequenceEqual怎么用?C# IEnumerable.SequenceEqual使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnumerable
的用法示例。
在下文中一共展示了IEnumerable.SequenceEqual方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CallEquals
/// <summary>
/// Check if a call to this function with the given arguments is equal to an expression.
/// </summary>
/// <param name="Arguments"></param>
/// <param name="E"></param>
/// <returns></returns>
public virtual bool CallEquals(IEnumerable<Expression> Arguments, Expression E)
{
Call C = E as Call;
if (ReferenceEquals(C, null)) return false;
return Equals(C.Target) && Arguments.SequenceEqual(C.Arguments);
}
示例2: CheckFinishingGeneration
/**
* Check the end of the game
* if a new generation died or changed then the end
* @param currentGeneration
* @param nextGeneration
* @return if end then true
*/
bool CheckFinishingGeneration(IEnumerable<Cell> currentGeneration,
IEnumerable<Cell> nextGeneration)
{
if (currentGeneration != null && nextGeneration != null)
return (nextGeneration.Count() == 0 || currentGeneration.SequenceEqual(nextGeneration));
else
return true;
}
示例3: VerifyAgainstBaselineResults
private static void VerifyAgainstBaselineResults(EntityDataReader reader, IEnumerable<object> expectedResults)
{
var actualResults = new List<object>();
while (reader.Read())
{
actualResults.Add(reader.GetValue(0));
}
Assert.True(expectedResults.SequenceEqual(actualResults));
}
示例4: RandomizePlayerOrder
public IEnumerable<string> RandomizePlayerOrder(IEnumerable<string> players)
{
IEnumerable<string> randomOrderOfPlayers = players.OrderBy(c => generator.Generate(1, players.Count())).ToList();
if (players.SequenceEqual(randomOrderOfPlayers))
{
randomOrderOfPlayers = RandomizePlayerOrder(randomOrderOfPlayers);
}
return randomOrderOfPlayers;
}
示例5: AssertDatabaseMigrationsAreEqual
private static void AssertDatabaseMigrationsAreEqual(
string appliedMigrationId,
IEnumerable<string> expected,
IEnumerable<string> actual)
{
if (expected.SequenceEqual(actual))
{
return;
}
throw new MigrationAssertFailedExecption(
appliedMigrationId,
$"Expected migrations did not match the actual migrations after migrating to {appliedMigrationId}.");
}
示例6: SetSelectionCommand
/// <summary>
/// Constructor</summary>
/// <param name="selectionContext">Selection context. See <see cref="ISelectionContext"/>.</param>
/// <param name="previous">Selection's previous state</param>
/// <param name="next">Selection's next state</param>
public SetSelectionCommand(
ISelectionContext selectionContext,
IEnumerable<object> previous,
IEnumerable<object> next)
: base("Set Selection".Localize())
{
if (selectionContext == null)
throw new ArgumentNullException("selectionContext");
m_selectionContext = selectionContext;
m_previous = Snapshot(previous);
// if previous is the same as next, then use the same array
if (previous.SequenceEqual(next))
m_next = m_previous;
else
m_next = Snapshot(next);
}
示例7: ContainsCompletions
private void ContainsCompletions(IEnumerable<string> completions, params string[] expected)
{
var same = completions.SequenceEqual(expected);
if (!same)
{
System.Console.Error.WriteLine("Expected");
System.Console.Error.WriteLine("--------");
foreach (var completion in expected)
{
System.Console.WriteLine(completion);
}
System.Console.Error.WriteLine();
System.Console.Error.WriteLine("Found");
System.Console.Error.WriteLine("-----");
foreach (var completion in completions)
{
System.Console.WriteLine(completion);
}
}
Assert.Equal(expected, completions);
}
示例8: SequenceEquals
private static bool SequenceEquals(IEnumerable<string> s1, IEnumerable<string> s2)
{
if (s1 == s2)
{
return true;
}
return s1 != null && s2 != null && s1.SequenceEqual(s2);
}
示例9: MetaDataChanged
private static bool MetaDataChanged(
IEnumerable<KeyValuePair<string, string>> lh,
IEnumerable<KeyValuePair<string, string>> rh)
{
return lh.SequenceEqual(rh, new NameValueEqualityComparer()) == false;
}
示例10: CheckCompatibility
private bool CheckCompatibility(Game game, IEnumerable<PropertyDef> properties)
{
return properties.SequenceEqual(game.CustomProperties);
}
示例11: HasArgumentsForConstructor
internal static FakeOptions HasArgumentsForConstructor(this IArgumentConstraintManager<FakeOptions> scope, IEnumerable<object> argumentsForConstructor)
{
return scope.Matches(x => argumentsForConstructor.SequenceEqual(x.ArgumentsForConstructor), "Constructor arguments ({0})".FormatInvariant(string.Join(", ", argumentsForConstructor.Select(x => x.ToString()).ToArray())));
}
示例12: FakeCallToSerializer
private IReturnValueConfiguration<string> FakeCallToSerializer(IEnumerable<dynamic> expectedArgument)
{
return A.CallTo(() => serializer.Serialize(arrayOfObjects)).WhenArgumentsMatch(x => expectedArgument.SequenceEqual((IEnumerable<dynamic>)x[0]));
}
示例13: IsEqualToParentState
private static bool IsEqualToParentState(NodeInterface node, IEnumerable<int> state)
{
return node != null && state.SequenceEqual(((GameNode) node).Tiles);
}
示例14: GetServicesShouldReturnExpectedObjects
public void GetServicesShouldReturnExpectedObjects( IReadOnlyList<Tuple<Type, string, object>> services, Type serviceType, IEnumerable<object> expected )
{
// arrange
var serviceProvider = new ServiceProviderAdapter(
( t, s ) => services.Where( i => i.Item1 == t && i.Item2 == s ).Select( i => i.Item3 ).FirstOrDefault(),
( t, s ) => services.Where( i => i.Item1 == t && i.Item2 == s ).Select( i => i.Item3 ) );
// act
var actual = serviceProvider.GetServices( serviceType );
// assert
Assert.True( expected.SequenceEqual( actual ) );
}
示例15: _matchInOrderWithTitles
private static bool _matchInOrderWithTitles(List<Book> books, IEnumerable<string> titles)
{
return titles.SequenceEqual(books.Select(b => b.Title));
}