Właściwość CodeClass.FullName —
Pobiera pełną ścieżkę i nazwę CodeClass pliku źródłowego obiektu.
Przestrzeń nazw: EnvDTE
Zestaw: EnvDTE (w EnvDTE.dll)
Składnia
'Deklaracja
ReadOnly Property FullName As String
string FullName { get; }
property String^ FullName {
String^ get ();
}
abstract FullName : string with get
function get FullName () : String
Wartość właściwości
Typ: String
Ciąg reprezentujący pełną ścieżkę i nazwę CodeClass pliku źródłowego obiektu.
Uwagi
FullName Właściwość jest znany jako FileName właściwość w niektórych wersjach programu Visual Studio.
[!UWAGA]
Po dokonaniu niektórych rodzajów modyfikacji, co oznacza, że ich wartości nie może polegać na zawsze pozostawać taki sam może być nie deterministyczny wartości elementów modelu kodu, takich jak klasy, strukturach, funkcje, atrybuty, delegatów i tak dalej.Aby uzyskać więcej informacji, zobacz sekcję wartości elementu modelu kod można zmienić w Odnajdowanie kodu za pomocą modelu kodu (Visual Basic).
Przykłady
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);
}
Zabezpieczenia programu .NET Framework
- Pełne zaufanie do bezpośredniego wywołującego. Tego elementu członkowskiego nie można używać w kodzie częściowo zaufanym. Aby uzyskać więcej informacji, zobacz Używanie bibliotek pochodzących z częściowo zaufanego kodu.
Zobacz też
Informacje
Inne zasoby
Porady: kompilowanie i uruchamianie kodu modelu obiektów automatyzacji — przykłady