请ASP.NET高手帮忙详细解释下这段代码
-
2012年3月19日 11:32
public partial class MasterPage : System.Web.UI.MasterPage
{
string mValue = "";
public string MValue
{
get
{
return mValue;
}
set
{
mValue = value;
}
}我现在引用@MasterType指令来访问母版页上的属性
书上对这段代码的解释是在母版页中定义了一个String类型的公共属性MValue
但是这段代码我看不懂,请高手帮我解释下
全部回复
-
2012年4月1日 9:05这个就是在模板里写个属性,还是我理解简单了?
-
2012年4月2日 3:58
意思和以下代码是类似的
public partial class MasterPage : System.Web.UI.MasterPage
{
string mValue = "";public void setMValue(string MValue)
{
this.mValue=MValue;
}
public string getMValue()
{
return this.mValue;
}- The blog of typewriter職人
- Convert C# to VB.NET
- /*If my concept is wrong ,please correct me.Thanks.*/
-
2012年4月13日 3:02同意1楼的看法
-
2012年4月16日 4:55通过公共属性变量“MValue”来给母版页中的“mValue”变量赋值或查询。
never give up,never drop up!
-
2012年5月28日 8:47get获取,set设置。就是属性了,有的只有get,或者set。最基本的,不过我也是学了很久才能理解到意思。呵呵,只可意会,
-
2012年7月18日 11:27这是一个get,set属性访问器,意思是可以对MValue这个属性进行get(读)和set(写)
Software originates from life

