Proprietà CodeClass.FullName

Ottiene il percorso completo e il nome di CodeClass il file di origine oggetto.

Spazio dei nomi:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Sintassi

'Dichiarazione
ReadOnly Property FullName As String
string FullName { get; }
property String^ FullName {
    String^ get ();
}
abstract FullName : string
function get FullName () : String

Valore proprietà

Tipo: System.String
Stringa che rappresenta il percorso completo e il nome di CodeClass il file di origine oggetto.

Note

FullName la proprietà è nota come FileName proprietà in alcune versioni di Visual Studio.

[!NOTA]

I valori degli elementi del modello di codice come classi, strutture, le funzioni, gli attributi, delegati, e così via possono non essere deterministici dopo l'inserimento di determinati tipi di modifiche, pertanto i relativi valori non possono essere basati su per rimanere sempre gli stessi.Per ulteriori informazioni, vedere i valori degli elementi del modello di codice della sezione può cambiare in Individuazione di codice mediante il modello di codice (Visual Basic).

Esempi

Public Sub CodeClassExample(ByVal dte As DTE2) 
    ' Before running this example, open a code document from a
    ' project and place the insertion point inside a class definition.
    Try
        Dim objTextSel As TextSelection
        Dim objCodeCls As CodeClass
        Dim objCodeElem As CodeElement
        objTextSel = CType(dte.ActiveDocument.Selection, TextSelection)
        objCodeCls = CType(objTextSel.ActivePoint.CodeElement(vsCMElement.vsCMElementClass), CodeClass)
        ' Display the fullname of CodeClass object.
        MessageBox.Show(objCodeCls.FullName)
        ' Prove that the parent object of a CodeClass is a CodeElement.
        objCodeElem = CType(objCodeCls.Parent, CodeElement)
        ' Get access privilege for CodeClass.
        MessageBox.Show(objCodeCls.Access.ToString())
        ' Change access privilege for CodeClass objCodeCls.
        ' Note the change in access keyword in your code document.
        objCodeCls.Access = vsCMAccess.vsCMAccessPublic
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try
End Sub
public void CodeClassExample(DTE2 dte)
{ 
   // Before running this example, open a code document from a
   // project and place the insertion point inside a class definition.
   try
   {
      TextSelection objTextSel;
      CodeClass objCodeCls;
      CodeElement objCodeElem;
      objTextSel = (TextSelection)dte.ActiveDocument.Selection;
      objCodeCls = (CodeClass)objTextSel.ActivePoint.get_CodeElement(vsCMElement.vsCMElementClass);
      // Display the fullname of CodeClass object.
      MessageBox.Show(objCodeCls.FullName);
      // Prove that the parent object of a CodeClass is a CodeElement.
      objCodeElem = (CodeElement)objCodeCls.Parent;
      // Get access privilege for CodeClass.
      MessageBox.Show(objCodeCls.Access.ToString());
      // Change access privilege for CodeClass objCodeCls.
      // Note the change in access keyword in your code document.
      objCodeCls.Access = vsCMAccess.vsCMAccessPublic;
   }
   catch (Exception ex)
   { 
      MessageBox.Show(ex.Message);
   }

Sicurezza di .NET Framework

Vedere anche

Riferimenti

CodeClass Interfaccia

Spazio dei nomi EnvDTE

Altre risorse

Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione

Individuazione di codice mediante il modello di codice (Visual Basic)

Individuazione di codice mediante il modello di codice (Visual C#)