110,536
社区成员
发帖
与我相关
我的任务
分享
public object<string, string> demo(){
return null;
}
protected void Page_Load(object sender, EventArgs e)
{
Dictionary<string, string> d = new Dictionary<string, string>();
d.Add("1", "张三");
d.Add("2", "李四");
Hashtable h = new Hashtable();
h.Add("1", "张三");
h.Add("2", "李四");
}
public myObject<string, string> demo()
{
myObject<string, string> m = new myObject<string, string>();
m.Key = "张三";
m.Value = "李四";
return m;
}
最好还是自定义一个类型!
public class myObject<string, string>
{
public string Key { get; set; }
public string Value { get; set; }
}
public class myObject<TKey, TValue>
{
public TKey Key { get; set; }
public TValue Value { get; set; }
}
public myObject<string, string> demo(){
return null;
}
public object demo(string, string){
return null;
}