Xamarin Public Jenkins (auto-signing) e79aa3c0ed Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
2016-08-03 10:59:49 +00:00

82 lines
2.1 KiB
C#

//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
namespace System.Runtime.DurableInstancing
{
using System.Diagnostics.CodeAnalysis;
using System.Runtime;
using System.Runtime.Serialization;
[Fx.Tag.XamlVisible(false)]
[DataContract]
public sealed class InstanceValue
{
readonly static InstanceValue deletedValue = new InstanceValue();
public InstanceValue(object value)
: this(value, InstanceValueOptions.None)
{
}
public InstanceValue(object value, InstanceValueOptions options)
{
Value = value;
Options = options;
}
InstanceValue()
{
Value = this;
}
public object Value { get; private set; }
public InstanceValueOptions Options { get; private set; }
public bool IsDeletedValue
{
get
{
return object.ReferenceEquals(this, InstanceValue.DeletedValue);
}
}
public static InstanceValue DeletedValue
{
get
{
return InstanceValue.deletedValue;
}
}
[DataMember(Name = "Value", EmitDefaultValue = false)]
[SuppressMessage(FxCop.Category.Performance, FxCop.Rule.AvoidUncalledPrivateCode, Justification = "Called from Serialization")]
internal object SerializedValue
{
get
{
return this.Value;
}
set
{
this.Value = value;
}
}
[DataMember(Name = "Options", EmitDefaultValue = false)]
[SuppressMessage(FxCop.Category.Performance, FxCop.Rule.AvoidUncalledPrivateCode, Justification = "Called from Serialization")]
internal InstanceValueOptions SerializedOptions
{
get
{
return this.Options;
}
set
{
this.Options = value;
}
}
}
}