namespace Test
{
public class Test
{
private static int m_iTest = -1;
public static int Test
{
get
{
if (m_iTest == -1)
{
m_iTest = 10;
} return m_iTest;
}
}
static void Main()
{
if (Test == -1)
{ }
}
}
}在get属性的if (m_iTest == -1)语句处加一个断点,按F5运行程序,在断点处断下,把鼠标移到m_iTest变量上查看其值,再把鼠标移到Main函数中的Test上查看其值,然后又把
鼠标移回m_iTest变量上查看其值。就移动几下鼠标,VS就悄悄的执行了语句m_iTest = 10; 看来调试时查看属性的值要注意了!环境:XP, VS2008, .NET FRAMEWORK 3.5
{
public class Test
{
private static int m_iTest = -1;
public static int Test
{
get
{
if (m_iTest == -1)
{
m_iTest = 10;
} return m_iTest;
}
}
static void Main()
{
if (Test == -1)
{ }
}
}
}在get属性的if (m_iTest == -1)语句处加一个断点,按F5运行程序,在断点处断下,把鼠标移到m_iTest变量上查看其值,再把鼠标移到Main函数中的Test上查看其值,然后又把
鼠标移回m_iTest变量上查看其值。就移动几下鼠标,VS就悄悄的执行了语句m_iTest = 10; 看来调试时查看属性的值要注意了!环境:XP, VS2008, .NET FRAMEWORK 3.5
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货