object类型如何转换
我得到的是这样的东西,我要怎么转换 --------------------编程问答-------------------- 二维数组,按行列访问就行了 --------------------编程问答-------------------- foreach(object p in list){ string var=p.name;} --------------------编程问答--------------------
不会弄啊,帮我写两句代码看一下,谢谢了。 --------------------编程问答-------------------- 两位数字中的元素是object,你想转换成什么 --------------------编程问答-------------------- 或者说我要得到[1,1]中的那个"a",怎么写 --------------------编程问答--------------------
或者说我要得到[1,1]中的那个"a",怎么写 --------------------编程问答-------------------- 谁来帮我解答啊 --------------------编程问答--------------------
object[] arr = new object[3];
arr[0] = 1;
arr[1] = "test";
Button testButton = new Button();
testButton.ID = "testButton";
arr[2] = testButton;
string stringResult = string.Empty;
int intResult = 0;
Button btnResult = null;
foreach (object item in arr)
{
if (item is string)
{
stringResult = (string)item;
}
else if (item is int)
{
intResult = (int)item;
}
else if (item is Button)
{
btnResult = (Button)item;
}
}
强制转换一下就是了,你想知道什么 --------------------编程问答-------------------- range.Cells[1,1]? --------------------编程问答-------------------- 不同的对象有不同的解决方法。要看你的range是什么了
补充:.NET技术 , C#