C# Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 298 Page Views: 

How to initialize Dictionary<int, string> using collection initialize?



Posted By: Avi Date: 14 October 2010 05:01:31 AM
 Answer:

Dictionary t = new Dictionary() { {1, “a”}, {2, “vb”}, {3, “c”}};


Posted By: avibtech


Date: 14 October 2010 05:01:31 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image EvljRQ
Related Questions
C# : What is the difference between the System.Array.CopyTo() and System.Array.Clone()?

What is the difference between the System.Array.CopyTo() and System.Array.Clone()?

CopyTo() method copies all the elements of the current one-dimensional Array to the specified one-di....
Category: C# Date: 10/15/2009 4:33:18 AM
C# : Is it possible to store multiple data types in System.Array object?
C# : What is the difference between String and StringBuilder type?

What is the difference between String and StringBuilder type?

String type is immutable while a StringBuilder type is mutable. StringBuilder objects performs bette....
Category: C# Date: 10/15/2009 4:12:05 AM
C# : What is the difference between a Struct and a Class?

What is the difference between a Struct and a Class?

Following are the two major differences between a Struct and a Class: 1) Struct is a value type whi....
Category: C# Date: 10/13/2009 11:20:40 PM
C# : Explain using statement?

Explain using statement?

We create an object intance in a "using" statement to ensure that "Dispose" is c....
Category: C# Date: 9/30/2009 7:12:51 AM