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 6897241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:08:38+00:00 2026-05-27T07:08:38+00:00

I am reading about LINQ and seeing Collection Initialzers come up, but does it

  • 0

I am reading about LINQ and seeing Collection Initialzers come up, but does it really directly relate to LINQ like Object Initializers do?

List<string> stringsNew = new List<string> { "string 1", "string 2" };
  • 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-27T07:08:39+00:00Added an answer on May 27, 2026 at 7:08 am

    Collection initializers can be said to be related to Linq in so far as you can thank Linq that the feature made it into C# 3. In case something ever happens to the linked question, the useful text is

    The by-design goal motivated by typical usage scenarios for collection
    initializers was to make initialization of existing collection types
    possible in an expression syntax so that collection initializers could
    be embedded in query comprehensions or converted to expression trees.

    Every other scenario was lower priority; the feature exists at all
    because it helps make LINQ work.

    -Eric Lippert

    They are useful in the context of Linq because they give you the ability to write stuff like the below example

    var query = from foo in foos 
                select new Bar 
                {
                    ValueList = new List<string> { foo.A, foo.B, foo.C }
                };
    

    Where you can construct a query that projects a given foo into a Bar with a list of foo’s property values. Without such initializer support, you couldn’t create such a query (although you could turn ValueList into a static-length array and achieve something similar).

    But, like object initializers and other features that are new with C# 3+, many features inspired or added expressly to make Linq work are no doubt useful in code that has nothing at all to do with Linq, and they do not require Linq to work (either via a using directive or DLL reference). Initializers are ultimately nothing more than syntactic sugar that the compiler will turn into the longer code you would have had to write yourself in earlier language versions.

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

Sidebar

Related Questions

I have spent quite a few hours reading and learning about LINQ to XML , but
I've been reading a fair bit about the performance of using LINQ rather than
While reading about exception, I will always come across checked exceptions and unchecked exceptions,
I was just reading about Linq to SQL being discontinued. For a while I
Reading about both Linq to SQL and Entity Framework I have developed the impression
In reading about C#, I have come across the terms data transfer type and
I am reading about Linq. Please explain to me how Linq, DLinq and XLinq
Reading about and using the Amazon Web Services, I'm not really able to grasp
Reading about both separatedly, looks like the same, html+xml+javascript. What's the difference between then?
I have been reading a lot about this - I feel like I'm very

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.