﻿// Decompiled with JetBrains decompiler
// Type: System.Web.UI.WebControls.WebParts.WebDescriptionAttribute
// Assembly: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 7E68A73E-4066-4F24-AB0A-F147209F50EC
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Web.dll

using System;
using System.Runtime;

namespace System.Web.UI.WebControls.WebParts
{
  /// <summary>
  /// Defines the string value to use as a ToolTip for a property of a Web Parts control.
  /// </summary>
  [AttributeUsage(AttributeTargets.Property)]
  public class WebDescriptionAttribute : Attribute
  {
    /// <summary>
    /// Represents an instance of the <see cref="T:System.Web.UI.WebControls.WebParts.WebDescriptionAttribute"/> class with the <see cref="P:System.Web.UI.WebControls.WebParts.WebDescriptionAttribute.Description"/> property set to an empty string ("").
    /// </summary>
    public static readonly WebDescriptionAttribute Default = new WebDescriptionAttribute();
    private string _description;

    /// <summary>
    /// Gets the ToolTip for a property to display in a <see cref="T:System.Web.UI.WebControls.WebParts.PropertyGridEditorPart"/> control.
    /// </summary>
    /// 
    /// <returns>
    /// A <see cref="T:System.String"/> containing the value to display in a <see cref="T:System.Web.UI.WebControls.WebParts.PropertyGridEditorPart"/>.
    /// </returns>
    public virtual string Description
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this.DescriptionValue;
      }
    }

    /// <summary>
    /// Gets or sets the ToolTip to display in the <see cref="T:System.Web.UI.WebControls.WebParts.PropertyGridEditorPart"/> control.
    /// </summary>
    /// 
    /// <returns>
    /// A <see cref="T:System.String"/> containing the value to display in a <see cref="T:System.Web.UI.WebControls.WebParts.PropertyGridEditorPart"/>.
    /// </returns>
    protected string DescriptionValue
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return this._description;
      }
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] set
      {
        this._description = value;
      }
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.WebParts.WebDescriptionAttribute"/> class.
    /// </summary>
    public WebDescriptionAttribute()
      : this(string.Empty)
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.WebParts.WebDescriptionAttribute"/> class with the specified description.
    /// </summary>
    /// <param name="description">The ToolTip to use in a <see cref="T:System.Web.UI.WebControls.WebParts.PropertyGridEditorPart"/>. </param>
    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    public WebDescriptionAttribute(string description)
    {
      this._description = description;
    }

    /// <summary>
    /// Returns a value that indicates whether this instance is equal to a specified object.
    /// </summary>
    /// 
    /// <returns>
    /// true if <paramref name="obj"/> equals the type and value of this instance; otherwise, false.
    /// </returns>
    /// <param name="obj">An <see cref="T:System.Object"/> to compare with this instance, or null. </param>
    public override bool Equals(object obj)
    {
      if (obj == this)
        return true;
      WebDescriptionAttribute descriptionAttribute = obj as WebDescriptionAttribute;
      if (descriptionAttribute != null)
        return descriptionAttribute.Description == this.Description;
      return false;
    }

    /// <summary>
    /// Returns the hash code for the display name value.
    /// </summary>
    /// 
    /// <returns>
    /// A 32-bit signed integer hash code.
    /// </returns>
    public override int GetHashCode()
    {
      return this.Description.GetHashCode();
    }

    /// <summary>
    /// Determines whether the current instance is set to the default value.
    /// </summary>
    /// 
    /// <returns>
    /// true if the <see cref="T:System.Web.UI.WebControls.WebParts.WebDescriptionAttribute"/> equals <see cref="F:System.Web.UI.WebControls.WebParts.WebDescriptionAttribute.Default"/>; otherwise, false.
    /// </returns>
    public override bool IsDefaultAttribute()
    {
      return this.Equals((object) WebDescriptionAttribute.Default);
    }
  }
}
