FileCodeModel2.CodeElements 속성
코드 요소 컬렉션을 가져옵니다.
네임스페이스: EnvDTE80
어셈블리: EnvDTE80(EnvDTE80.dll)
구문
‘선언
ReadOnly Property CodeElements As CodeElements
Get
CodeElements CodeElements { get; }
property CodeElements^ CodeElements {
CodeElements^ get ();
}
abstract CodeElements : CodeElements
function get CodeElements () : CodeElements
속성 값
형식: EnvDTE.CodeElements
CodeElements 컬렉션입니다.
구현
예제
Sub CodeElementsExample(ByVal dte As DTE2)
' Before running this example, open a code document from a project.
Try
Dim fcm As FileCodeModel = _
dte.ActiveDocument.ProjectItem.FileCodeModel
' Find the FileCodeModel's children.
Dim children As String
Dim elem As CodeElement
For Each elem In fcm.CodeElements
children &= elem.Name & vbCrLf
Next
MsgBox(fcm.Parent.Name & _
" has the following top-level code elements:" & _
vbCrLf & vbCrLf & children)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
public void CodeElementsExample(DTE2 dte)
{
// Before running this example, open a code document from
// a project.
try
{
FileCodeModel fcm =
dte.ActiveDocument.ProjectItem.FileCodeModel;
// Find the FileCodeModel's children.
string children = "";
foreach (CodeElement elem in fcm.CodeElements)
{
children += elem.Name + Environment.NewLine;
}
MessageBox.Show(fcm.Parent.Name +
" has the following top-level code elements:" +
Environment.NewLine + Environment.NewLine + children);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
.NET Framework 보안
- 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.