在C#中获取数组值的问题 [英] Problems With Get Array Values in C#

查看:333
本文介绍了在C#中获取数组值的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我正在使用数组.我声明数组为

string[] arr=new string[100];


我分配了以下

 arr [i] = " ;
然后,我获取 arrayvalue

字符串 name = arr [ 0 ]; 


但是发生错误未设置对象引用"
有什么问题吗?请帮帮我.在此先感谢

解决方案

  string  [] arr =  字符串 [ 100 ];
arr [ 0 ] = "  ;
字符串 name = arr [ 0 ]; 


In my project, I am using array. I declare array is

string[] arr=new string[100];


And I assigned like following

arr[i]="C";
And I get the arrayvalue

string name=arr[0];


But the error occured ''Object Reference not set''
What is the Problem?Please help me. Thanks in advance

解决方案

string[] arr=new string[100];
arr[0]="C";
string name = arr[0];


这篇关于在C#中获取数组值的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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