如何在dictionay中返回sring和decimal值? [英] how to return sring and decimal value in dictionay?
本文介绍了如何在dictionay中返回sring和decimal值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public Dictionary<string,resultvalues> PrintConsole()
{
}
这个格式正确返回字典
键和值?
is this Format correct for return Dictionary
Key and and Value?
推荐答案
没有。您需要提供通用字典的键和值的类
No. You need to provide the class for the Key and Value of the Generic Dictionary
public Dictionary<string, decimal> PrintConsole()
{
}
Dictionary<tkey,tvalue>
Tkey
可以是任何输入
说{string,int etc ....}
TValue
可以是任何输入
说{object,datatable etc ....}
示例:
Tkey
can be any Type
say { string , int etc.... }
TValue
can be of any Type
say { object , datatable etc.... }
Example:
Dictionary<string,int> dictionary;
这个词典可以存储类型为string的唯一键
和任何整数值
。
示例:
This dictionary can store unique keys
of type string and any integer values
.
Sample:
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;
}
这篇关于如何在dictionay中返回sring和decimal值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文