const string[] DropDownListItems ={ "财政公告", "厅长文稿" };
提示错误:
编译器错误信息: CS0134: “DropDownListItems”的类型为“string[]”。只能用 null 对引用类型(字符串除外)的常量进行初始化
请问怎么解决?DropDownListItems 要在case语句中使用。
解决方案 »
- 截取字符串到数组的问题
- WPF DataTable 中如何添加控件
- 什么工具可以生成web版的注释说明文档
- sqlserver 扩展存储过程问题
- 如何给所有控件添加自定义的属性?
- 数据库中自动增加的字段是主键,通过DataAdapter、DataSet怎么操作才好?
- 请帮我设计一套方案(Email发送问题)
- 求助:怎么得到ListView中的具体某个单元格的值
- 开发小组取名字?要个响亮好听的英文名字!!
- 如何在异步UDP通讯中,如何得到发送UDP数据的IP地址
- c#中为什么Button的KeyDown事件不能接收方向键
- 写了个webservice,用http的POST方式去请求,ContentType设置为"text/xml; charset=utf-8"就可以访问,设置其他就不能访问,怎么修改?
http://msdn.microsoft.com/zh-tw/vstudio/ms228606.aspx
{
readonly string[] a = { "a", "b" }; static void Main(string[] args)
{ const int b = 1;
}
}
switch case 语句要求是常量值,满足不了。
我是c++学多了,有点傻了。
{
string caseSwitch = "1";
int ii = Array.IndexOf(a, caseSwitch);
if (ii > -1)
{
MessageBox.Show("found");
}
else
{
MessageBox.Show("not found");
}
}
readonly string[] a = { "a", "b" };
这样做吧,找到就等于是执行Case后面的分支
const string[] DropDownListItems = new string[]{ "财政公告", "厅长文稿" };
const string str= "";
const int[] int= null;
const一般是编译期间直接直接copy到引用的地方
可使用枚举