new List() : List « System.Collections.Generic « C# / C Sharp by API






new List()

 
using System.Collections.Generic;
using System;


class MainClass
{
    public static void Main(string[] args)
    {

        List<MyClass> list = new List<MyClass>();

        list.Add(new MyClass());

        MyClass ass2 = list[0];

        Console.WriteLine("\nFound in list: {0}", ass2);
    }
}
class MyClass {
    
   public override string ToString(){
    
      return "my class";
   }
    
}

   
  








Related examples in the same category

1.extends List
2.List.Add
3.List.AsReadOnly()
4.List.Capacity
5.List.ConvertAll
6.List.Count
7.List.ForEach
8.List.Remove()