CodeClass2.InfoLocation Özellik

Tanım

Kod modelinin yeteneklerini alır.

public:
 property EnvDTE::vsCMInfoLocation InfoLocation { EnvDTE::vsCMInfoLocation get(); };
public:
 property EnvDTE::vsCMInfoLocation InfoLocation { EnvDTE::vsCMInfoLocation get(); };
[System.Runtime.InteropServices.DispId(7)]
public EnvDTE.vsCMInfoLocation InfoLocation { [System.Runtime.InteropServices.DispId(7)] [System.Runtime.InteropServices.TypeLibFunc(1024)] get; }
[<System.Runtime.InteropServices.DispId(7)>]
[<get: System.Runtime.InteropServices.DispId(7)>]
[<get: System.Runtime.InteropServices.TypeLibFunc(1024)>]
member this.InfoLocation : EnvDTE.vsCMInfoLocation
Public ReadOnly Property InfoLocation As vsCMInfoLocation

Özellik Değeri

vsCMInfoLocation

vsCMInfoLocationSabit bir değer.

Uygulamalar

Öznitelikler

Örnekler

[Visual Basic]

Sub InfoLocationExample(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  
        ' Retrieve the CodeClass at the insertion point.  
        Dim sel As TextSelection = _  
            CType(dte.ActiveDocument.Selection, TextSelection)  
        Dim cls As CodeClass = _  
            CType(sel.ActivePoint.CodeElement( _  
            vsCMElement.vsCMElementClass), CodeClass)  

        ' Display the class's location.  
        MsgBox(cls.Name & "'s InfoLocation value is " & _  
            cls.InfoLocation.ToString())  

        Dim cm As CodeModel = _  
            cls.ProjectItem.ContainingProject.CodeModel  
        Dim name As String = ConvertFullName(cm, "System.Object")  
        Dim obj As CodeType = cm.CodeTypeFromFullName(name)  

        ' Display System.Object's location.  
        MsgBox(obj.FullName & "'s InfoLocation value is " & _  
            obj.InfoLocation.ToString())  
    Catch ex As Exception  
        MsgBox(ex.Message)  
    End Try  
End Sub  

Function ConvertFullName(ByVal cm As CodeModel, _  
    ByVal fullName As String) As String  
    ' Convert a .NET type name into a C++ type name.  
    If (cm.Language = CodeModelLanguageConstants.vsCMLanguageVC) Or _  
        (cm.Language = CodeModelLanguageConstants.vsCMLanguageMC) Then  
        Return fullName.Replace(".", "::")  
    Else  
        Return fullName  
    End If  
End Function  

Þ

public void InfoLocationExample(DTE2 dte)  
{  
    // Before running this example, open a code document from a project  
    // and place the insertion point inside a class definition.  
    try  
    {  
        // Retrieve the CodeClass at the insertion point.  
        TextSelection sel =   
            (TextSelection)dte.ActiveDocument.Selection;  
        CodeClass cls =   
            (CodeClass)sel.ActivePoint.get_CodeElement(  
            vsCMElement.vsCMElementClass);  

        // Display the class's location.  
        MessageBox.Show(cls.Name + "'s InfoLocation value is " +   
            cls.InfoLocation.ToString());  

        CodeModel cm = cls.ProjectItem.ContainingProject.CodeModel;  
        string name = ConvertFullName(cm, "System.Object");  
        CodeType obj = cm.CodeTypeFromFullName(name);  

        // Display System.Object's location.  
        MessageBox.Show(obj.FullName + "'s InfoLocation value is " +   
            obj.InfoLocation.ToString());  
    }  
    catch (Exception ex)  
    {  
        MessageBox.Show(ex.Message);  
    }  
}  

string ConvertFullName(CodeModel cm, string fullName)  
{  
    // Convert a .NET type name into a C++ type name.  
    if ((cm.Language == CodeModelLanguageConstants.vsCMLanguageVC) ||   
        (cm.Language == CodeModelLanguageConstants.vsCMLanguageMC))  
        return fullName.Replace(".", "::");  
    else  
        return fullName;  
}  

Açıklamalar

InfoLocationÖzelliği döndürürse vsCMInfoLocationProject , özellikleri ayarlayabilir, elde edebilir StartPoint , alabilir EndPoint ve benzerlerini yapabilirsiniz. Bir kod modeli nesnesinden (A) diğerine (B) (bir işlevden veya bir sınıftan taban sınıfına) gittiğinizde, vsCMInfoLocationExternal tanımı başka bir projede ise, B türünde olabilir. Disposition, nesne B 'nin projesinin nesne A ile aynı dilde uygulanıp uygulanmayacağı, kod modeli uygulamasına bağlıdır ve bu şekilde devam eder.

InfoLocationDönerse vsCMInfoLocationExternal , bilgiler yalnızca meta verilerden, bir dll 'yi inceleyerek veya dondurulmuş kaynaklardan kullanılabilir. Bir ve elde edebilirsiniz StartPoint EditPoint ancak belgeyi düzenleyemezsiniz; diğer bir deyişle, özellikleri ayarlayamazsınız veya kod öğesinin arkasındaki metni değiştiremezsiniz.

InfoLocationÖğesini döndürürse vsCMInfoLocationNone , tüm kullanılabilir bir adı olan bir kod modeli nesnesidir. Ayrıca, kaynak kodun bağlamına göre, bazı durumlarda adın bir sınıf veya arabirim olması gerekip gerekmediğini söyleyebilirsiniz. Ancak, bu durumda, kod modeli adı herhangi bir yararlı bilgiye çözümleyemediği için, nesne başka bir şekilde kullanılamaz.

Not

Sınıfların, yapıların, işlevlerin, özniteliklerin, temsilcilerin ve bu gibi kod modeli öğelerinin değerleri, belirli tür düzenlemeler yapıldıktan sonra belirleyici olmayan bir değer olabilir, yani değerlerinin her zaman aynı kalır. Daha fazla bilgi için bkz. kod modeli öğe değerleri, kod modeli kullanılarak kod bulma bölümünde değişebilir (Visual Basic).

Şunlara uygulanır