Megosztás a következőn keresztül:


Reference3.Aliases Property

Gets or sets the aliased names for the specified reference. This property applies to Visual C# only.

Namespace:  VSLangProj80
Assembly:  VSLangProj80 (in VSLangProj80.dll)

Syntax

'Declaration
Property Aliases As String
'Usage
Dim instance As Reference3 
Dim value As String 

value = instance.Aliases

instance.Aliases = value
string Aliases { get; set; }
property String^ Aliases {
    String^ get ();
    void set (String^ value);
}
function get Aliases () : String 
function set Aliases (value : String)

Property Value

Type: System.String
A string representing the name of the aliases.

Remarks

In Visual C#, you can use one or more alternate names, or aliases, for reference names in projects. This property allows you to view or set the aliases.

Examples

This example tests to see if a project is a Visual C# project, and it then lists all the aliases for the project references. Open a Visual C# project before running this example. 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)
    DisplayAliases(applicationObject)
End Sub
Public Sub DisplayAliases(ByVal dte As DTE2)
    ' The first project is a Visual Basic, C# or J# project.
    Dim vsProject As VSProject2 = _
    CType(applicationObject.Solution.Projects.Item(1).Object, _
    VSProject2)
    Dim aRef As Reference3
    Dim refStr As String
    refStr = ""
    If vsProject.Project.Kind = PrjKind.prjKindCSharpProject Then
        For Each aRef In vsProject.References
            refStr += (aRef.Name & " " & aRef.Aliases & vbCr)
         Next
         MsgBox(refStr)
    Else
         MsgBox("The project is not a C# project")
    End If
End Sub

.NET Framework Security

See Also

Reference

Reference3 Interface

Reference3 Members

VSLangProj80 Namespace