Click here to Skip to main content
15,898,995 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public Dictionary<string,resultvalues> PrintConsole() 
{

}

is this Format correct for return Dictionary

Key and and Value?
Posted
Updated 5-Dec-13 21:11pm
v3
Comments
Alexander Dymshyts 6-Dec-13 6:53am    
What is resultValues?

No. You need to provide the class for the Key and Value of the Generic Dictionary
C#
public Dictionary<string, decimal> PrintConsole()
{

}
 
Share this answer
 
C#
Dictionary<tkey,tvalue>


Tkey can be any Type say { string , int etc.... }
TValue can be of any Type say { object , datatable etc.... }

Example:

C#
Dictionary<string,int> dictionary;

This dictionary can store unique keys of type string and any integer values.
Sample:
C#
public Dictionary<string, int> PrintConsole()
       {
           Dictionary<string, int> dic = new Dictionary<string, int>();
           dic.Add("one", 1);
           dic.Add("two", 2);
           dic.Add("three", 3);
           return dic;
       }
 
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