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