一键多值 [英] One Key with multiple values

查看:77
本文介绍了一键多值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用一个具有多个值的键.例如,
键:CString
值1:CString
值2:Int
值3:Float
值4:CString

如果我传递了任何重复的密钥,则必须重写,例如已经存储了一个名为"Car"的密钥.如果我尝试再次存储相同的密钥名称和不同的值,则必须重写.请帮助我..在此先感谢

I want to use one key with multiple values. For example,
Key: CString
Value1: CString
Value2: Int
Value3: Float
Value4: CString

If i pass any duplicate key it has to overwrite for example already i stored a key called "Car" If i try to store again the same key name and different values it has to overwrite. Plz help me.. Thanks in advance

推荐答案

尝试 ^ ]类.




你需要像
一样上课


you need to make class like

public class Vehical
{
 
string key=string.Empty;
string value1=string.Empty;
int value2=0;
string value3=string.Empty; 
string value4=string.Empty; 
}



现在使vehical类的列表对象
喜欢,

list<vehical> obj;

您可以使用此和lamda表达式添加,更新,删除,查找等更多内容.

希望这项工作对您有帮助...



And now make list object of class vehical
like,

list<vehical> obj;

you can add,update,delete,find and many more using this and lamda expression.

hopes this work for u...


这篇关于一键多值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆