Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
398 lines (382 sloc) 21.8 KB
<Type Name="DescriptionAttribute" FullName="System.ComponentModel.DescriptionAttribute">
<TypeSignature Language="C#" Value="public class DescriptionAttribute : Attribute" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit DescriptionAttribute extends System.Attribute" />
<TypeSignature Language="DocId" Value="T:System.ComponentModel.DescriptionAttribute" />
<TypeSignature Language="VB.NET" Value="Public Class DescriptionAttribute&#xA;Inherits Attribute" />
<TypeSignature Language="C++ CLI" Value="public ref class DescriptionAttribute : Attribute" />
<TypeSignature Language="F#" Value="type DescriptionAttribute = class&#xA; inherit Attribute" />
<AssemblyInfo>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Attribute</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-3.0;netstandard-2.1">
<AttributeName>System.AttributeUsage(System.AttributeTargets.All)</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Specifies a description for a property or event.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A visual designer can display the specified description when referencing the component member, such as in a Properties window. Call <xref:System.ComponentModel.DescriptionAttribute.Description%2A> to access the value of this attribute.
For more information, see [Attributes](~/docs/standard/attributes/index.md).
## Examples
The following example creates the `MyImage` property. The property has two attributes, a <xref:System.ComponentModel.DescriptionAttribute> and a <xref:System.ComponentModel.CategoryAttribute>.
[!code-cpp[Classic DescriptionAttribute Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CPP/source.cpp#1)]
[!code-csharp[Classic DescriptionAttribute Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CS/source.cs#1)]
[!code-vb[Classic DescriptionAttribute Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic DescriptionAttribute Example/VB/source.vb#1)]
The next example gets the description of `MyImage`. First the code gets a <xref:System.ComponentModel.PropertyDescriptorCollection> with all the properties for the object. Next it indexes into the <xref:System.ComponentModel.PropertyDescriptorCollection> to get `MyImage`. Then it returns the attributes for this property and saves them in the attributes variable.
The example then prints the description by retrieving <xref:System.ComponentModel.DescriptionAttribute> from the <xref:System.ComponentModel.AttributeCollection>, and writing it to the console screen.
[!code-cpp[Classic DescriptionAttribute Example#2](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CPP/source.cpp#2)]
[!code-csharp[Classic DescriptionAttribute Example#2](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CS/source.cs#2)]
[!code-vb[Classic DescriptionAttribute Example#2](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic DescriptionAttribute Example/VB/source.vb#2)]
]]></format>
</remarks>
<altmember cref="T:System.Attribute" />
<altmember cref="T:System.ComponentModel.PropertyDescriptor" />
<altmember cref="T:System.ComponentModel.EventDescriptor" />
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DescriptionAttribute" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public DescriptionAttribute ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.ComponentModel.DescriptionAttribute.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; DescriptionAttribute();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DescriptionAttribute" /> class with no parameters.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public DescriptionAttribute (string description);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string description) cil managed" />
<MemberSignature Language="DocId" Value="M:System.ComponentModel.DescriptionAttribute.#ctor(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (description As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; DescriptionAttribute(System::String ^ description);" />
<MemberSignature Language="F#" Value="new System.ComponentModel.DescriptionAttribute : string -&gt; System.ComponentModel.DescriptionAttribute" Usage="new System.ComponentModel.DescriptionAttribute description" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="description" Type="System.String" />
</Parameters>
<Docs>
<param name="description">The description text.</param>
<summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DescriptionAttribute" /> class with a description.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Default">
<MemberSignature Language="C#" Value="public static readonly System.ComponentModel.DescriptionAttribute Default;" />
<MemberSignature Language="ILAsm" Value=".field public static initonly class System.ComponentModel.DescriptionAttribute Default" />
<MemberSignature Language="DocId" Value="F:System.ComponentModel.DescriptionAttribute.Default" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Default As DescriptionAttribute " />
<MemberSignature Language="C++ CLI" Value="public: static initonly System::ComponentModel::DescriptionAttribute ^ Default;" />
<MemberSignature Language="F#" Value=" staticval mutable Default : System.ComponentModel.DescriptionAttribute" Usage="System.ComponentModel.DescriptionAttribute.Default" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.ComponentModel.DescriptionAttribute</ReturnType>
</ReturnValue>
<Docs>
<summary>Specifies the default value for the <see cref="T:System.ComponentModel.DescriptionAttribute" />, which is an empty string (""). This <see langword="static" /> field is read-only.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Description">
<MemberSignature Language="C#" Value="public virtual string Description { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Description" />
<MemberSignature Language="DocId" Value="P:System.ComponentModel.DescriptionAttribute.Description" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property Description As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ Description { System::String ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Description : string" Usage="System.ComponentModel.DescriptionAttribute.Description" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the description stored in this attribute.</summary>
<value>The description stored in this attribute.</value>
<remarks>To be added.</remarks>
<altmember cref="P:System.ComponentModel.DescriptionAttribute.DescriptionValue" />
</Docs>
</Member>
<Member MemberName="DescriptionValue">
<MemberSignature Language="C#" Value="protected string DescriptionValue { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string DescriptionValue" />
<MemberSignature Language="DocId" Value="P:System.ComponentModel.DescriptionAttribute.DescriptionValue" />
<MemberSignature Language="VB.NET" Value="Protected Property DescriptionValue As String" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; property System::String ^ DescriptionValue { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.DescriptionValue : string with get, set" Usage="System.ComponentModel.DescriptionAttribute.DescriptionValue" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the string stored as the description.</summary>
<value>The string stored as the description. The default value is an empty string ("").</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default implementation of the <xref:System.ComponentModel.DescriptionAttribute.Description%2A> property simply returns this value.
This extra property exists so that you can derive from <xref:System.ComponentModel.DescriptionAttribute> and provide a localized version. The derived localizable <xref:System.ComponentModel.DescriptionAttribute> will maintain a private Boolean field to indicate if it has been localized. On the first access to the <xref:System.ComponentModel.DescriptionAttribute.Description%2A> property, it will look up the localized string and store it back in the <xref:System.ComponentModel.DescriptionAttribute.DescriptionValue%2A> property.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Equals">
<MemberSignature Language="C#" Value="public override bool Equals (object obj);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool Equals(object obj) cil managed" />
<MemberSignature Language="DocId" Value="M:System.ComponentModel.DescriptionAttribute.Equals(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function Equals (obj As Object) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; override bool Equals(System::Object ^ obj);" />
<MemberSignature Language="F#" Value="override this.Equals : obj -&gt; bool" Usage="descriptionAttribute.Equals obj" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="obj" Type="System.Object" />
</Parameters>
<Docs>
<param name="obj">The object to test the value equality of.</param>
<summary>Returns whether the value of the given object is equal to the current <see cref="T:System.ComponentModel.DescriptionAttribute" />.</summary>
<returns>
<see langword="true" /> if the value of the given object is equal to that of the current; otherwise, <see langword="false" />.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="GetHashCode">
<MemberSignature Language="C#" Value="public override int GetHashCode ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance int32 GetHashCode() cil managed" />
<MemberSignature Language="DocId" Value="M:System.ComponentModel.DescriptionAttribute.GetHashCode" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function GetHashCode () As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; override int GetHashCode();" />
<MemberSignature Language="F#" Value="override this.GetHashCode : unit -&gt; int" Usage="descriptionAttribute.GetHashCode " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns the hash code for this instance.</summary>
<returns>A 32-bit signed integer hash code.</returns>
<remarks>To be added.</remarks>
<altmember cref="M:System.Attribute.GetHashCode" />
</Docs>
</Member>
<Member MemberName="IsDefaultAttribute">
<MemberSignature Language="C#" Value="public override bool IsDefaultAttribute ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool IsDefaultAttribute() cil managed" />
<MemberSignature Language="DocId" Value="M:System.ComponentModel.DescriptionAttribute.IsDefaultAttribute" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function IsDefaultAttribute () As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; override bool IsDefaultAttribute();" />
<MemberSignature Language="F#" Value="override this.IsDefaultAttribute : unit -&gt; bool" Usage="descriptionAttribute.IsDefaultAttribute " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.Primitives</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns a value indicating whether this is the default <see cref="T:System.ComponentModel.DescriptionAttribute" /> instance.</summary>
<returns>
<see langword="true" />, if this is the default <see cref="T:System.ComponentModel.DescriptionAttribute" /> instance; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default value is an empty string ("").
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.