Freigeben über


Reference3.Description Property

Definition

Gets a text description of the reference.

public:
 property System::String ^ Description { System::String ^ get(); };
public:
 property Platform::String ^ Description { Platform::String ^ get(); };
[System.Runtime.InteropServices.DispId(9)]
public string Description { [System.Runtime.InteropServices.DispId(9)] get; }
[<System.Runtime.InteropServices.DispId(9)>]
[<get: System.Runtime.InteropServices.DispId(9)>]
member this.Description : string
Public ReadOnly Property Description As String

Property Value

For a Reference object, the return value depends on the reference type.Reference TypeValue ReturnedAssemblyAssembly description.COMType library description.

Implements

Attributes

Examples

This example displays the Description strings for all references in an open Visual Basic or Visual C# project. To run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

Imports VSLangProj  
Imports VSLangProj2  
Imports VSLangProj80  
Public Sub OnConnection(ByVal application As Object,_  
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _  
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection  
    applicationObject = CType(application, DTE2)  
    addInInstance = CType(addInInst, AddIn)  
    DisplayDescriptions(applicationObject)  
End Sub  
Public Sub DisplayDescriptions(ByVal dte As DTE2)  
    ' The first project is a Visual Basic or C# project.  
    Dim vsProject As VSProject2 = _  
    CType(applicationObject.Solution.Projects.Item(1).Object, _  
    VSProject2)  
    Dim aRef As Reference3  
    Dim refStr As String  
    refStr = ""  
    For Each aRef In vsProject.References  
        refStr += (aRef.Name & "'s description is:  " _  
        & aRef.Description.ToString() & vbCr & vbCr)  
    Next  
    MsgBox(refStr)  
End Sub  
using System.Windows.Forms;  
using VSLangProj;  
using VSLangProj2;  
using VSLangProj80;  
public void OnConnection(object application,  
 ext_ConnectMode connectMode, object addInInst, ref Array custom)  
{  
    applicationObject = (DTE2)application;  
    addInInstance = (AddIn)addInInst;  
    DisplayDescriptions(((DTE2)applicationObject));  
}  
public void DisplayDescriptions(DTE2 dte)  
{  
    // The first project is a Visual Basic or C# project.  
    VSProject2 vsProject = ((VSProject2)  
 (applicationObject.Solution.Projects.Item(1).Object));  
    Reference aRef = null;  
    string refStr = null;  
    foreach (VSLangProj80.Reference3 temp in vsProject.References)  
    {  
        aRef = temp;  
        refStr += (aRef.Name + "'s Description is:   "   
+ aRef.Description.ToString() + "\n" + "\n");  
    }  
    MessageBox.Show(refStr);  
}  

Remarks

The Description property and Name property of a reference differ in purpose and length. The Name property, for example System.Windows.Forms, is meant to be descriptive yet short. The Description property may be longer and contain more detailed information. It has the same function as a COM type library description.

The Description property is stored as a custom attribute in the assembly. This is unlike most other properties exposed by the Reference object, which are stored in the metadata.

This read-only property may be changed in the development environment by editing the custom attributes in the AssemblyInfo.vb file (for Visual Basic projects) or the AssemblyInfo.cs file (Visual C# projects).

Applies to