我有一个属性的基类
public class Parameters
{
public string caption
{
get;
set;
}
public string subcaption
{
get;
set;
}
public string bgColor
{
get
{
if (bgColor == " ")
return bgColor = "FFFFFF";
else
return bgColor;
}
set { bgColor = value; }
}
}
//some other properties with default return values
和其他类继承自该类并具有返回字符串生成器的方法
public class Bar : Parameters
{
public StringBuilder GetXML()
{
StringBuilder xmlData = new StringBuilder();
xmlData.Append("<chart bgColor='" + bgColor + "'"
+ " caption='" + caption + "'"
+ " subcaption='" + subcaption + "'>");//mentioned here are some properties there are many in the xmldata.append function
return xmlData;
}
}
现在其他一些类试图通过声明对象来访问这个方法
Bar XML = new Bar();
XML.caption = "Caption";
XML.subcaption = "subcap"; //setting values properties which dont have default return values
XML.GetXML();
当调试器进入GetXML方法调试器强制关闭自己时,我在这里缺少什么是与此相关的吗