using System;
namespace System.ComponentModel
{
/// Specifies the default value for a property.
// Token: 0x0200006E RID: 110
[AttributeUsage(AttributeTargets.All)]
public class DefaultValueAttribute : Attribute
{
/// Initializes a new instance of the class using a value.
/// A that is the default value.
// Token: 0x060003FF RID: 1023 RVA: 0x0000C1E0 File Offset: 0x0000A3E0
public DefaultValueAttribute(bool value)
{
this.DefaultValue = value;
}
/// Initializes a new instance of the class using an 8-bit unsigned integer.
/// An 8-bit unsigned integer that is the default value.
// Token: 0x06000400 RID: 1024 RVA: 0x0000C1F4 File Offset: 0x0000A3F4
public DefaultValueAttribute(byte value)
{
this.DefaultValue = value;
}
/// Initializes a new instance of the class using a Unicode character.
/// A Unicode character that is the default value.
// Token: 0x06000401 RID: 1025 RVA: 0x0000C208 File Offset: 0x0000A408
public DefaultValueAttribute(char value)
{
this.DefaultValue = value;
}
/// Initializes a new instance of the class using a double-precision floating point number.
/// A double-precision floating point number that is the default value.
// Token: 0x06000402 RID: 1026 RVA: 0x0000C21C File Offset: 0x0000A41C
public DefaultValueAttribute(double value)
{
this.DefaultValue = value;
}
/// Initializes a new instance of the class using a 16-bit signed integer.
/// A 16-bit signed integer that is the default value.
// Token: 0x06000403 RID: 1027 RVA: 0x0000C230 File Offset: 0x0000A430
public DefaultValueAttribute(short value)
{
this.DefaultValue = value;
}
/// Initializes a new instance of the class using a 32-bit signed integer.
/// A 32-bit signed integer that is the default value.
// Token: 0x06000404 RID: 1028 RVA: 0x0000C244 File Offset: 0x0000A444
public DefaultValueAttribute(int value)
{
this.DefaultValue = value;
}
/// Initializes a new instance of the class using a 64-bit signed integer.
/// A 64-bit signed integer that is the default value.
// Token: 0x06000405 RID: 1029 RVA: 0x0000C258 File Offset: 0x0000A458
public DefaultValueAttribute(long value)
{
this.DefaultValue = value;
}
/// Initializes a new instance of the class.
/// An that represents the default value.
// Token: 0x06000406 RID: 1030 RVA: 0x0000C26C File Offset: 0x0000A46C
public DefaultValueAttribute(object value)
{
this.DefaultValue = value;
}
/// Initializes a new instance of the class using a single-precision floating point number.
/// A single-precision floating point number that is the default value.
// Token: 0x06000407 RID: 1031 RVA: 0x0000C27C File Offset: 0x0000A47C
public DefaultValueAttribute(float value)
{
this.DefaultValue = value;
}
/// Initializes a new instance of the class using a .
/// A that is the default value.
// Token: 0x06000408 RID: 1032 RVA: 0x0000C290 File Offset: 0x0000A490
public DefaultValueAttribute(string value)
{
this.DefaultValue = value;
}
/// Initializes a new instance of the class, converting the specified value to the specified type, and using an invariant culture as the translation context.
/// A that represents the type to convert the value to.
/// A that can be converted to the type using the for the type and the U.S. English culture.
// Token: 0x06000409 RID: 1033 RVA: 0x0000C2A0 File Offset: 0x0000A4A0
public DefaultValueAttribute(Type type, string value)
{
try
{
if (type.IsEnum)
{
this.DefaultValue = Enum.Parse(type, value);
}
else if (type == typeof(TimeSpan))
{
this.DefaultValue = TimeSpan.Parse(value);
}
else
{
this.DefaultValue = Convert.ChangeType(value, type, null);
}
}
catch
{
}
}
/// Gets the default value of the property this attribute is bound to.
/// An that represents the default value of the property this attribute is bound to.
// Token: 0x17000112 RID: 274
// (get) Token: 0x0600040A RID: 1034 RVA: 0x0000C32C File Offset: 0x0000A52C
public virtual object Value
{
get
{
return this.DefaultValue;
}
}
/// Sets the default value for the property to which this attribute is bound.
/// The default value.
// Token: 0x0600040B RID: 1035 RVA: 0x0000C334 File Offset: 0x0000A534
protected void SetValue(object value)
{
this.DefaultValue = value;
}
/// Returns whether the value of the given object is equal to the current .
/// true if the value of the given object is equal to that of the current; otherwise, false.
/// The object to test the value equality of.
// Token: 0x0600040C RID: 1036 RVA: 0x0000C340 File Offset: 0x0000A540
public override bool Equals(object obj)
{
DefaultValueAttribute defaultValueAttribute = obj as DefaultValueAttribute;
if (defaultValueAttribute == null)
{
return false;
}
if (this.DefaultValue == null)
{
return defaultValueAttribute.Value == null;
}
return this.DefaultValue.Equals(defaultValueAttribute.Value);
}
// Token: 0x0600040D RID: 1037 RVA: 0x0000C384 File Offset: 0x0000A584
public override int GetHashCode()
{
if (this.DefaultValue == null)
{
return base.GetHashCode();
}
return this.DefaultValue.GetHashCode();
}
// Token: 0x0400014B RID: 331
private object DefaultValue;
}
}