what r arraylist?
what the use of Hashtables?

Answer Posted / sharmin jose

Everything told above is correct except that ArrayList can
only contain "similar data type".
Please compile and execute the following code:
using System;
using System.Collections;
public class SamplesArrayList {

public static void Main() {

// Creates and initializes a new ArrayList.
ArrayList MyList = new ArrayList();
MyList.Add("Hello");
MyList.Add("World");
MyList.Add(1);

// Displays the properties and values of the
ArrayList.
Console.WriteLine( "MyList" );
Console.WriteLine( "\tCount: {0}", MyList.Count );
Console.WriteLine( "\tCapacity: {0}",
MyList.Capacity );
Console.Write( "\tValues:" );
PrintValues( MyList );
}

public static void PrintValues( IEnumerable myAL ) {
System.Collections.IEnumerator myEnumerator =
myAL.GetEnumerator();
while ( myEnumerator.MoveNext() )
Console.Write( "\t{0}", myEnumerator.Current );
Console.WriteLine();
}
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different ways of method can be overloaded?

460


How to find the current application file path while runtime?

507


How long does a loop recorder procedure take?

521


What are verbatim strings in c#?

497


What are Regex / regular expressions ?

599






What is an indexer in c#?

547


How to Show Message box in Metro Style App?

571


What is default class in c#?

505


What is difference between private and protected?

504


What is the task perform by clr?

577


What is polymorphism c# example?

485


What is the difference between a field and a property in c#?

497


Why to use “finally” block in c#?

534


What is the difference between static and private constructor in c#?

460


What is dapper in c#?

466