我有这个代码,我有一个arrayList。我使用方法arrayList.Contains。C#插入一个变量
if (arrayList2.Contains(5))
{
//something
}
我想在代码中用一个包含值arrayList2的变量(例如一个字符串)替换arrayList2。
string hello = "arrayList2" // create a varible with the value of the name of the arrayList
if (hello.Contains(5)) // insert the variable "hello" instead of "arrayList2"
{
//something
}
此方法不起作用,任何想法如何我可以得到它的工作?
你是什么意思5?这是索引或子字符串? – red1ynx 2011-06-13 10:22:09
你还没有澄清这个问题,而不是你之前关闭的问题。 *你为什么认为这是你想要做的事情?* – 2011-06-13 10:23:17
命名变量'hello'让我觉得你不尊重我们,并期望我们猜测你的难题。 – Snowbear 2011-06-13 10:25:39