Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is List??

What is Dictionary??


i need Major Difference
Posted
Updated 15-Apr-16 20:50pm

Why don't you use google?

http://lmgtfy.com/?q=c%23+list+vs+dictionary[^]
 
Share this answer
 
hi luisenike,

list:-
1)it accepts similar data type values at a time.(only single data type at a time either int or string or etc........
ex:- list < int >
//please observe this
{
XML
List<int> list = new List<int>();
    list.Add(2);
    list.Add(3);
    list.Add(7);


}

2)List type is ideal for linear collections not accessed by keys.

Dictionary:-

1) it accepts different data types at a time.

ex:- Dictionary < String,int >
//observe this
{
XML
Dictionary<string, int> dictionary =
        new Dictionary<string, int>();
    dictionary.Add("naresh", 2);
    dictionary.Add("luisenike", 1);
    dictionary.Add("sagar", 0);
    dictionary.Add("rajsekar", -1);

}

2) Dictionary is composed of separate keys and values.



regards:
nareshraju
 
Share this answer
 
v2
 
Share this answer
 
Comments
Shree@786 17-Feb-14 1:24am    
Hi,
i am new to C#.net...
On what basis should the Dictionary and List be used?
Thnx...
Check this one.....C# List Vs Dictionary

Throt
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900