VCCodeStruct.ValidateMember - метод
Validates that the proposed name is a valid Visual C++ name for the kind given in the context of the parent object.
Пространство имен: Microsoft.VisualStudio.VCCodeModel
Сборка: Microsoft.VisualStudio.VCCodeModel (в Microsoft.VisualStudio.VCCodeModel.dll)
Синтаксис
'Декларация
Function ValidateMember ( _
bstrName As String, _
Kind As vsCMElement, _
bstrType As String _
) As Boolean
'Применение
Dim instance As VCCodeStruct
Dim bstrName As String
Dim Kind As vsCMElement
Dim bstrType As String
Dim returnValue As Boolean
returnValue = instance.ValidateMember(bstrName, _
Kind, bstrType)
bool ValidateMember(
string bstrName,
vsCMElement Kind,
string bstrType
)
bool ValidateMember(
[InAttribute] String^ bstrName,
[InAttribute] vsCMElement Kind,
[InAttribute] String^ bstrType
)
function ValidateMember(
bstrName : String,
Kind : vsCMElement,
bstrType : String
) : boolean
Параметры
bstrName
Тип: System.StringRequired. The name of the object being validated.
Kind
Тип: EnvDTE.vsCMElementRequired. A vsCMElement value representing the type of object to be validated.
bstrType
Тип: System.StringOptional. The type of object being validated.
Возвращаемое значение
Тип: System.Boolean
true if the proposed name is a valid Visual C++ name; otherwise, false.
Заметки
See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.
Примеры
This example validates a method name and then, if valid, adds a method with that name to the class.
Sub AddMethod()
Dim vcCM As VCCodeModel
Dim classElement As VCCodeClass
Dim type As String
vcCM = DTE.Solution.Item(1).CodeModel
classElement = vcCM.Classes.Item(1)
type = "int"
If (vcCM.ValidateMember("Method1", vsCMElement.vsCMElementFunction, type)) Then
classElement.AddFunction("Method1", vsCMFunction.vsCMFunctionFunction, type)
End If
End Sub
Разрешения
- Полное доверие для непосредственно вызывающего метода. Этот член не может быть использован частично доверенным кодом. Дополнительные сведения см. в разделе Using Libraries from Partially Trusted Code.