2
我正在面对我的MonoTouch应用程序中某个属性的奇怪行为。 似乎该属性不能返回给定的值,但MonoDevelop中的调试器说,后台的私有字段实际上保存了值?属性不会返回私有字段的值
这是属性是怎么实现的:
public int? Status
{
get { return this._status; }
internal set
{
if (this._status != value)
{
// Status hat sich geändert, darum Speichervorgang nötig
this._mustBeSaved = true;
this._status = value;
this.NotifyPropertyChanged("Status");
}
}
}
在这里你可以看到调试器说:
Debugger http://img818.imageshack.us/img818/2226/propertyw.png
这怎么可能,反射值(“值” )保持正确的值,并且反射字段“has_value”表示它不是一次保持任何值?出于这个原因,无法从属性中获取价值。
(这和我的其他属性之间的唯一区别是,这个属性为空)
没错,虽然调试器应该真的使这个透明,因为编译器。我提交了一个bug:https://bugzilla.xamarin.com/show_bug.cgi?id = 6282 – 2012-07-25 16:43:05