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

How assembly versioning in .NET prevent DLL Hell problem?

694


What is c sharp used for?

662


Why is .net so popular?

694


What is difference between new and override in c#?

623


What is yield in c#?

654


Is it possible to have different access modifiers on the get/set methods of a property in c#?

765


Can constructor have return type c#?

804


How to do and Apply Themes to Datagrid,Lable,Textbox,etc., in C#.NET 2005 Windows Application? (like who we will do themes in ASP.NET using .CSS and .SKIN files). Urgent!!

1864


How C# 4.0 supports dynamic programming language?

757


What is session state in asp net c# with example?

646


Can the nested class access, the containing class. Give an example?

652


Is collection a data structure?

714


What are the advantages of using delegates in c#?

647


If you define a user defined data type by using the class keyword, is it a value type or reference type?

698


Can a dictionary have the same key?

705