VCCodeClass.ValidateMember Method
Validates that the proposed name is a valid C++ name for the kind given in the context of the parent object.
Namespace: Microsoft.VisualStudio.VCCodeModel
Assembly: Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)
Syntax
声明
Function ValidateMember ( _
bstrName As String, _
Kind As vsCMElement, _
bstrType As String _
) As Boolean
用法
Dim instance As VCCodeClass
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
Parameters
bstrName
Type: System.StringRequired. The name of the object being validated.
Kind
Type: vsCMElementRequired. A vsCMElement value representing the type of object to be validated.
bstrType
Type: System.StringOptional. The type of object being validated.
Return Value
Type: System.Boolean
true if the object's name validates; otherwise, false.
Examples
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
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualStudio.VCCodeModel Namespace
vsCMElement