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

  • Home
  • SEARCH
  • 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 71787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:56:33+00:00 2026-05-10T19:56:33+00:00

I use LINQ to Objects instructions on an ordered array. Which operations shouldn’t I

  • 0

I use LINQ to Objects instructions on an ordered array. Which operations shouldn’t I do to be sure the order of the array is not changed?

  • 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. 2026-05-10T19:56:34+00:00Added an answer on May 10, 2026 at 7:56 pm

    I examined the methods of System.Linq.Enumerable, discarding any that returned non-IEnumerable results. I checked the remarks of each to determine how the order of the result would differ from order of the source.

    Preserves Order Absolutely. You can map a source element by index to a result element

    • AsEnumerable
    • Cast
    • Concat
    • Select
    • ToArray
    • ToList

    Preserves Order. Elements are filtered or added, but not re-ordered.

    • Distinct
    • Except
    • Intersect
    • OfType
    • Prepend (new in .net 4.7.1)
    • Skip
    • SkipWhile
    • Take
    • TakeWhile
    • Where
    • Zip (new in .net 4)

    Destroys Order – we don’t know what order to expect results in.

    • ToDictionary
    • ToLookup

    Redefines Order Explicitly – use these to change the order of the result

    • OrderBy
    • OrderByDescending
    • Reverse
    • ThenBy
    • ThenByDescending

    Redefines Order according to some rules.

    • GroupBy – The IGrouping objects are yielded in an order based on the order of the elements in source that produced the first key of each IGrouping. Elements in a grouping are yielded in the order they appear in source.
    • GroupJoin – GroupJoin preserves the order of the elements of outer, and for each element of outer, the order of the matching elements from inner.
    • Join – preserves the order of the elements of outer, and for each of these elements, the order of the matching elements of inner.
    • SelectMany – for each element of source, selector is invoked and a sequence of values is returned.
    • Union – When the object returned by this method is enumerated, Union enumerates first and second in that order and yields each element that has not already been yielded.

    Edit: I’ve moved Distinct to Preserving order based on this implementation.

        private static IEnumerable<TSource> DistinctIterator<TSource>       (IEnumerable<TSource> source, IEqualityComparer<TSource> comparer)     {         Set<TSource> set = new Set<TSource>(comparer);         foreach (TSource element in source)             if (set.Add(element)) yield return element;     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer PHP does have hash data structures built into the language.… May 11, 2026 at 12:56 pm
  • added an answer You can use AES 256, many vendors use it and… May 11, 2026 at 12:56 pm
  • added an answer Untested, but is it something like: XNamespace ns = @'http://schemas.microsoft.com/developer/msbuild/2003';… May 11, 2026 at 12:56 pm

Related Questions

I use LINQ to Objects instructions on an ordered array. Which operations shouldn't I
How can I use Linq with Dataset.xsd files? I've looked at Linq-to-Datasets and Linq-to-XSD
I decided to use LINQ to SQL in my personal project after hearing lots
I would like to use Linq to Xml to get a single XElement from
I would like to use Linq to query a bus schedule in my project,
In which situations I should use LINQ to Objects? Obviously I can do everything
I have a program that stores data in objects in memory that you can
I need to create several applications that all share a Microsoft SQL Server database.
I recently found LINQ and love it. I find lots of occasions where use

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.