ProjectItem.FileCodeModel Eigenschaft

Definition

Ruft das FileCodeModel-Objekt für das Projektelement ab.Gets the FileCodeModel object for the project item.

public:
 property EnvDTE::FileCodeModel ^ FileCodeModel { EnvDTE::FileCodeModel ^ get(); };
public:
 property EnvDTE::FileCodeModel ^ FileCodeModel { EnvDTE::FileCodeModel ^ get(); };
[System.Runtime.InteropServices.DispId(117)]
public EnvDTE.FileCodeModel FileCodeModel { [System.Runtime.InteropServices.DispId(117)] get; }
[<System.Runtime.InteropServices.DispId(117)>]
[<get: System.Runtime.InteropServices.DispId(117)>]
member this.FileCodeModel : EnvDTE.FileCodeModel
Public ReadOnly Property FileCodeModel As FileCodeModel

Eigenschaftswert

FileCodeModel

Ein FileCodeModel-Objekt.A FileCodeModel object.

Attribute

Beispiele

Sub FileCodeModelExample()  
   ' This goes through the current document using the Visual Studio   
   ' Code Model to add documentation style comments to each function   
   ' similar to  the Visual C# documenation comments.  
   Dim projitem As ProjectItem = DTE.ActiveDocument.ProjectItem  
   Dim filecm As FileCodeModel = projitem.FileCodeModel  
   Dim celt As CodeElement = filecm.CodeElements.Item(1)  
   Dim celttype As CodeType = CType(celt, CodeType)  
   Dim ep As EditPoint = celttype.GetStartPoint(vsCMPart.vsCMPartHeader).CreateEditPoint()  

   For Each celt In celttype.Members  
      If (celt.Kind = vsCMElement.vsCMElementFunction) Then  
         ' Get Params.  
         Dim codefun As CodeFunction = celt  
         ep.MoveToPoint(codefun.GetStartPoint(vsCMPart.vsCMPartHeader))  
         Dim params As CodeElements = codefun.Parameters  

         ' Do comment.  
         ep.Insert(Microsoft.VisualBasic.Constants.vbCrLf)  
         ep.LineUp()  
         ' ep.Indent(Nothing) ' shouldn't need to pass Nothing.  
         ep.Insert(Microsoft.VisualBasic.Constants.vbTab & "''' <summary>")  
         ep.Insert(Microsoft.VisualBasic.Constants.vbCrLf)  
         ep.Insert(Microsoft.VisualBasic.Constants.vbTab & "''' Summary of this sub.")  
         ep.Insert(Microsoft.VisualBasic.Constants.vbCrLf)  
         ep.Insert(Microsoft.VisualBasic.Constants.vbTab & "''' <summary>")  
         ep.Insert(Microsoft.VisualBasic.Constants.vbCrLf)  
         ep.Insert(Microsoft.VisualBasic.Constants.vbTab & "''' ")  

         Dim celt2 As CodeElement  
         Dim cp As CodeParameter  
         For Each celt2 In params  
            cp = celt2  
            ep.Insert("<param name=" & cp.Name & "></param>")  
            ep.Insert(Microsoft.VisualBasic.Constants.vbCrLf)  
            ep.Insert(Microsoft.VisualBasic.Constants.vbTab & "''' ")  
         Next  
      End If  
   Next  
End Sub  

Hinweise

Ein FileCodeModel -Objekt wird nur für Projekt Elemente zurückgegeben, bei denen es sich um Code Dateien und in Projekten handelt, die das Visual StudioVisual Studio Code Modell implementieren.A FileCodeModel object is returned only for project items that are code files and in projects that implement the Visual StudioVisual Studio code model.

Gilt für: