Collection.Add() : Collection « System.Collections.Generic « C# / C Sharp by API






Collection.Add()

  

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

class MainClass
{
    static void Main() {
        Collection<int> numbers = new Collection<int>();
        numbers.Add( 2 );
        numbers.Add( 9 );

        Collection<string> strings = new Collection<string>();
        strings.Add( "J" );
        strings.Add( "B" );

        Collection< Collection<int> > colNumbers = new Collection<Collection<int>>();
        colNumbers.Add( numbers );

        IList<int> theNumbers = numbers;
        foreach( int i in theNumbers ) {
            Console.WriteLine( i );
        }
    }
}

   
    
  








Related examples in the same category

1.new Collection()
2.extends Collection