VCCodeInterface.ValidateMember(String, vsCMElement, String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Validates that the proposed name is a valid C++ name for the kind given in the context of the parent object.
bool ValidateMember(std::wstring const & bstrName, EnvDTE::vsCMElement Kind, std::wstring const & bstrType = "");
[System.Runtime.InteropServices.DispId(583)]
public bool ValidateMember (string bstrName, EnvDTE.vsCMElement Kind, string bstrType = "");
[<System.Runtime.InteropServices.DispId(583)>]
abstract member ValidateMember : string * EnvDTE.vsCMElement * string -> bool
Public Function ValidateMember (bstrName As String, Kind As vsCMElement, Optional bstrType As String = "") As Boolean
Parameters
- bstrName
- String
Required. The name of the object being validated.
- Kind
- vsCMElement
Required. A vsCMElement value representing the type of object to be validated.
- bstrType
- String
Optional. The type of object being validated.
Returns
true if the name is valid; otherwise, false.
- Attributes
Examples
This example validates a method name and then, if valid, adds a method with that name to the class.
[Visual Basic]
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
Remarks
See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.