public class A
{
public string Key;
public string type;
public string objectvalue;
} public class B
{
ArrayList arrayList;
public B()
{
ArrayList arrayList =new ArrayList() ;
}
public bool Add(A pp)
{
bool haveA=false;
foreach(object cc in arrayList)
{
A ee= cc as A;
if((ee!=null)&&(ee.Key ==pp.Key ))
{haveA=true;
break;
}
}
if(haveA)
return !(haveA);
else
{
arrayList.Add(pp);
return true;
}
}
}
{
public string Key;
public string type;
public string objectvalue;
} public class B
{
ArrayList arrayList;
public B()
{
ArrayList arrayList =new ArrayList() ;
}
public bool Add(A pp)
{
bool haveA=false;
foreach(object cc in arrayList)
{
A ee= cc as A;
if((ee!=null)&&(ee.Key ==pp.Key ))
{haveA=true;
break;
}
}
if(haveA)
return !(haveA);
else
{
arrayList.Add(pp);
return true;
}
}
}
解决方案 »
- c# 修改注册表项:SYSTEM\CurrentControlSet\Enum\usb 项 问题
- 如何删掉一个组的节点
- C#启用VF程序
- 关于AJAX控件的问题
- Linq里的表都是什么类型的?
- 救球.为什么程序能够正常运行 而密码修改这个模块不能修改成功(程序没有报错)
- 使用WebClient上传文件,报远程服务器返回错误(403)已禁止
- 请教一个小问题:winform, 如何把页面中的所有textbox变成只读?
- 请教大家,像QQ和MSN中界面的贴图,在拉伸或最大化后怎么能保证背景图片和界面联动和一部分保持不动!谢谢
- 异常出现在至少一个参数没有被指定值
- HxDataPage.Net翻页组件 v3.7发布,企业级数据翻页轻松搞定.来者有分!
- 快帮忙~~在线等待~~~
{
public string key;
public string type;
public string objectvalue;
} public class B
{
private Hashtable hTable;
public B()
{
hTable = new Hashtable();
}
public bool Add(A a)
{
if (a is A)
{
if (hTable.ContainsKey(a.key)) return false;
hTable.Add(a.key,a);
return true;
}
else return false;
}
public bool RemoveByKey(string key)
{
if (!hTable.ContainsKey(key)) return false;
hTable.Remove(key);
return true;
}
public A GetObject(string key)
{
return hTable[key];
}
}