About 26,200,000 results
Open links in new tab
  1. c# - getting a value out of an arrayList - Stack Overflow

    Oct 25, 2012 · You really shouldn't use an ArrayList in the first place, if you have a choice, you should use a List<T>. ArrayList has been effectively deprecated since .NET 2.0. There are no advantages to using it over List other than for legacy applications which …

  2. How to retrieve Object from arraylist in c# - Stack Overflow

    Jun 24, 2010 · var testObject = new KeyValuePair<string, string>("test", "property"); var list = new ArrayList(); list.Add(testObject); var fetch = (KeyValuePair<string, string>)list[0]; var endValue = fetch.Value;

  3. asp.net - get specific value from ArrayList in C# - Stack Overflow

    Jun 6, 2015 · The issue is that ArrayList stores all elements as object. You need to perform a cast to the type of object that contains myvalue. For example. ArrayList items = (ArrayList)Session["mycart"]; foreach(var v in items) { MyObject o = v as MyObject; if (o != null) { // do stuff with o.myvalue } }

  4. C# ArrayList (With Examples) - TutorialsTeacher.com

    Gets the number of elements actually contained in the ArrayList. IsFixedSize: Gets a value indicating whether the ArrayList has a fixed size. IsReadOnly: Gets a value indicating whether the ArrayList is read-only. Item: Gets or sets the element at the specified index.

  5. How to: use LINQ to query or modify collections - C#

    Apr 25, 2024 · How to query an ArrayList with LINQ. When using LINQ to query nongeneric IEnumerable collections such as ArrayList, you must explicitly declare the type of the range variable to reflect the specific type of the objects in the collection. If you have an ArrayList of Student objects, your from clause should look like this:

  6. ArrayList in C# - GeeksforGeeks

    Jan 19, 2022 · ArrayList class in C# is a part of the System.Collections namespace that represents an ordered collection of an object that can be indexed individually. It is basically an alternative to an array. It also allows dynamic memory allocation, adding, searching, and sorting items in the list.Elements can

  7. C# | Get or set the element at the specified index in ArrayList

    Jun 20, 2022 · ArrayList.Item [Int32] Property is used to get or set the element at the specified index in ArrayList. Syntax: Here, index is the zero-based index of the element to get or set. Return Value: It returns the element of Object type at the specified index.

  8. C# ArrayList - C# Corner

    C# ArrayList is a collection class. This tutorial shows how to use ArrayList in a C# application including Adding ArrayList Items, Removing item from an ArrayList, ArrayList properties, and ArrayList methods.

  9. c# - How to get data out of an Arraylist - Stack Overflow

    Jun 1, 2011 · public class Person { private string _name; public string Name { get { return _name; } } public Person(string name, string phone, string adress) { _name = name; ... } } Then you can populate instances of this class in your arraylist and access its properties.

  10. get values in Arraylist using c# - DotNetFunda.com

    Sep 22, 2012 · You can use the below code to add and display the value from ArrayList. static void Main(string[] args) { ArrayList arrList = new ArrayList(); Console.WriteLine("Enter Value"); string name = Console.ReadLine(); arrList.Add(name); Console.WriteLine("The value in the array list is"); Console.WriteLine(arrList[0].ToString()); Console.ReadLine(); }

Refresh