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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:26:40+00:00 2026-05-20T11:26:40+00:00

Actually I’m always using Generic Collections and I frequently use List<>. Some scenarios I

  • 0

Actually I’m always using Generic Collections and I frequently use List<>.
Some scenarios I think that new List<string>() is very ugly and I prefer to use string[], but I don’t use it, because as far as I know, Generics has a better performance and therefore I use them.

Is string[], int[] or whatever non-generic-array harmful to the application?

I just wanna know what’s really the difference, impact between arrays and generic collections.

edit:

let’s fake a scenario

I must call this method, should I use string[] or List<string>? What’s better?

static void PrintValues(IEnumerable<string> values) {
    foreach(var value in values) {
        Console.WriteLine(value);
    }
}
  • 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-20T11:26:41+00:00Added an answer on May 20, 2026 at 11:26 am

    The main difference is that you can add new elements to a List<T>.

    Internally List<T> stores elements in an array of type T[] and it just automatically allocates a larger array when you’re adding new elements (or shrinks the array when you’re removing elements). This means that the performance will be roughly similar. There is some minor indirection when using List<T>, but the JITter may inline that.

    The main reason for using List<T> is that it gives you more functionality – you can add and remove elements.

    EDIT In your example with PrintValues, it doesn’t really matter. It depends on the source of the data. If you just want to call it with some fixed arguments you can use arrays, because they’re easier to create, e.g. new [] { "hello", "world" }.

    In most of the real-world scenarios, you’ll be reading the data from somewhere – if you can get all data at once, then you can use arrays. If you’ll reading them one-by-one then you’ll use List<string> so that you can add elements as you read them.

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

Sidebar

Related Questions

Actually we are required to use C++ Static Library in PHP, for that we
Actually, if you use a method with new, create, alloc or copy in it's
Actually it works if i use port 8080 or some values bigger than 1023(i
Actually i am parsing some html pages by using scrapy, i have used xpath
Actually I am developing one application in that when application run first time it
Actually I am new to jquery as well as web designing Now I need
Actually I am stuck in middle of some mysql code. Can anyone suggest a
Actually i want that, suppose i have a colorcode #FF3366. How can i examine
Actually i work on java web application using spring mvc 3 and hibernate 3.5
Actually I have a serious problem : I saw that somebody has accessed my

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.