Export (0) Print
Expand All
ID
Top
Expand Minimize

FileCodeModel Property

Visual Studio .NET 2003

Returns the FileCodeModel object for the project item.

[Visual Basic .NET]
Public ReadOnly Property FileCodeModel() As FileCodeModel
[Visual Basic 6]
Property Get FileCodeModel() As FileCodeModel
[C++]
HRESULT __stdcall get_FileCodeModel(
   /* [out, retval] */ FileCodeModel** retVal
);
[C#]
FileCodeModel FileCodeModel {get;}
[JScript .NET]
public function get FileCodeModel() : FileCodeModel

Return Value

Returns a FileCodeModel object.

Remarks

A FileCodeModel object is returned only for project items that are code files and in projects that implement the Visual Studio .NET Code Model.

Example

Sub FileCodeModelExample()
   ' This goes through the current document using the VS .NET Code
   ' Model to add documentation style comments to each function similar to 
   ' the Visual C# .NET 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) 'HACK: 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

See Also

Applies To: ProjectItem Object

Show:
© 2014 Microsoft