Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4553074
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:53:38+00:00 2026-05-21T16:53:38+00:00

I was wondering if any one could show me any other ways this method

  • 0

I was wondering if any one could show me any other ways this method could be written, perhaps using LINQ?

private static bool CompareManyFoos(ManyFoos expected, ManyFoos actual)
{
    IEnumerator<Foo> expFooAtor = expected.GetEnumerator();
    IEnumerator<Foo> actFooAtor = actual.GetEnumerator();

    while (expFooAtor.MoveNext())
    {
        if (actFooAtor.MoveNext())
        {
            if (!FoosEqual(expFooAtor.Current, actFooAtor.Current)) return false;
        }
        else
        {
            MissingFoo(expFooAtor.Current);
            return false;
        }
    }
    return true;
}

EDIT

I’ve had to patch up my sample code a bit as I made some mistakes, sorry all. This is the original method, I adapted my sample code from:

    private static bool CompareXElementsChildXNodes(XElement expectedXElement, XElement actualXElement,
                                                    ref string message)
    {
        _itemLocator.LevelDown();

        IEnumerator<XNode> expectedNodeRator = expectedXElement.Nodes().GetEnumerator();
        IEnumerator<XNode> actualNodeRator = actualXElement.Nodes().GetEnumerator();

        while (expectedNodeRator.MoveNext())
        {
            if (actualNodeRator.MoveNext())
            {
                if (CompareXNodes(expectedNodeRator.Current, actualNodeRator.Current, ref message))
                {
                    _itemLocator.NextNode();
                }
                else
                {
                    return false;
                }
            }
            else
            {
                ExpectedXNodeActuallyMissing(expectedNodeRator.Current, ref message);
                return false;
            }
        }

        _itemLocator.LevelUp();

        return true;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T16:53:39+00:00Added an answer on May 21, 2026 at 4:53 pm

    Perhaps SequenceEqual would be what you’re looking for?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if anyone could show me how to search this array that
I was wondering if any one could help me out; I have a table
I was wondering if someone could work this one out as I've been trying
just wondering if anyone could show me how to do a couple simple commands
I was wondering if anyone could answer me this quick question. I tried searching
I'm wondering about how you would implement an effect similar to this one implemented
I was wondering whether anyone could assist me. When the user clicks the menu
I was wondering if anyone could instruct as how to replace hyperlinks with their
I was wondering if anyone could help me implement color selection in my iOS
I was wondering if anyone could tell me about the i++ operator in C#.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.