VCCodeUnion::ValidateMember Method (String^, vsCMElement, String^)
Visual Studio 2015
Validates that the proposed name is a valid C++ name for the kind given in the context of the parent object.
Assembly: Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)
Parameters
- bstrName
-
Type:
System::String^
Required. The name of the object being validated.
- Kind
-
Type:
EnvDTE::vsCMElement
Required. A vsCMElement value representing the type of object to be validated.
- bstrType
-
Type:
System::String^
Optional. The type of object being validated.
Return Value
Type: System::Booleantrue if the proposed element name is a valid 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
Show: