About 3,240,000 results
Open links in new tab
  1. What is the difference between C# array and C# list? - C# Corner

    Here are some of the key differences between C# lists and C# arrays: Size: Arrays have a fixed size that is set when they are created, while lists can grow or shrink dynamically as items are added or removed.

  2. Array versus List<T>: When to use which? - Stack Overflow

    Jan 12, 2009 · For method argument declarations, I tend to use IReadOnlyList<MyClass> or IList<MyClass> which can accept both arrays and lists. e.g. void Foo(IList<int> foo) can be called like Foo(new[] { 1, 2, 3 }) or Foo(new List<int> { 1, 2, 3 }). In C#, an array is a list. MyClass[] and List<MyClass> both implement IList<MyClass>.

  3. c# - What is the difference between an Array, ArrayList and a List ...

    They are different object types. They have different capabilities and store their data in different ways. An Array (System.Array) is fixed in size once it is allocated. You can't add items to it or remove items from it. Also, all the elements must be the same type.

  4. List vs Array: A Quick Guide That You Must Know About C#

    Jun 20, 2019 · In C#, arrays and lists are both objects that can be used to hold variables, but they aren’t interchangeable. Let’s explore list vs array. An array must be declared using brackets and accompanied by the type of variables it will hold (integers or strings) and by its name.

  5. C# Array VS List: 21+ Best Comparison Between Both

    Feb 9, 2024 · Understanding the key differences between C# arrays and lists in programming. This blog post explains distinctions including mutability, access methods, memory allocation, and use cases where arrays or list data structures are more appropriate.

  6. C# Array vs List: When should you use an array or a List in C#?

    Nov 14, 2021 · Here are the main differences between arrays and lists in C#: Fixed Size vs. Dynamic Size: Arrays have a fixed size that is defined when they are created, meaning you cannot easily change the size of an array once it has been initialized.

  7. C# - List VS Array, differences and when to use what

    Oct 9, 2022 · In this post we show the differences between Arrays and Lists, the differences between the two and when to use one over the other.

  8. What is the difference between an Array and Array List in C#

    Aug 22, 2023 · In C#, both arrays and ArrayList are used to store collections of objects, but they have different characteristics and are suited for different scenarios. Here's a breakdown of their...

  9. .net - ArrayList vs List<> in C# - Stack Overflow

    Feb 22, 2010 · ArrayList simply stores object references. As a generic collection, List<T> implements the generic IEnumerable<T> interface and can be used easily in LINQ (without requiring any Cast or OfType call). ArrayList belongs to the days that C# didn't have generics. It's deprecated in favor of List<T>.

  10. Arrays Vs Lists In C#: Understanding The Differences

    Nov 13, 2024 · In this article, we’ll explore the distinctions between arrays and lists, looking at how they work, how to use them, and when to choose one over the other. Array: An array is a fixed-size collection of elements of the same type. Defined with a set length at creation, arrays provide high-performance access to elements by index.

Refresh