【发布时间】:2013-09-13 06:40:05
【问题描述】:
例子:
public partial class abc1 : Form
{
public string str__subgrp { get; set; }
public string str__type { get; set; }
public string return_str__type { get; set;
public abc1()
{
InitializeComponent();
}
private void savebtn_click(object sender, EventArge e )
{
this.str__subgrp = "ABC";
this.str__type = "123";
this.return_str__type = "This word is unicode";
}
}
public partial class worknow : Form
{
// ... declare variable in class ....
public worknow()
{
InitializeComponent();
}
private void showformbtn_click(object sender, EventArge e )
{
string a,b,c;
using ( var abc1_frm = new abc1())
{
abc1_frm.ShowDialog();
a = abc1_frm.str__subgrp;
b = abc1_frm.str__type;
c = abc1_frm.return_str__type; // This variable = null
}
}
}
在注释行中(这个变量=null)
为什么变量return_str__type会返回null的值?
【问题讨论】:
-
你错过了
}??public string return_str__type { get; set; -
这不会编译,因为您在第五行缺少
}。 -
对不起小姐 } return_str__type = "ภาษาไทย" //