Compartir a través de


CodeElements.CreateUniqueID Method

Creates a programmatic identifier that does not collide with other identifiers in the scope and that follows the current language naming rules.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Function CreateUniqueID ( _
    Prefix As String, _
    <OutAttribute> ByRef NewName As String _
) As Boolean
bool CreateUniqueID(
    string Prefix,
    out string NewName
)
bool CreateUniqueID(
    [InAttribute] String^ Prefix, 
    [InAttribute] [OutAttribute] String^% NewName
)
abstract CreateUniqueID : 
        Prefix:string * 
        NewName:string byref -> bool
function CreateUniqueID(
    Prefix : String, 
    NewName : String
) : boolean

Parameters

  • Prefix
    Type: System.String

    Required. The prefix string or whole name to check to see whether or not it is unique for the collection of code elements.

  • NewName
    Type: System.String%

    Optional. If supplied, this returns with a guaranteed unique name.

Return Value

Type: System.Boolean
A Boolean value indicating true if the name is a unique identifier; otherwise returns false.

Remarks

Specifies whether or not Prefix is a unique identifier in the collection of code elements. If the second argument, NewName, is supplied, then it returns a unique name based on Prefix as a prefix, which is possibly the same characters with no additional characters. The return value, however, always returns whether Prefix is unique or not, regardless of whether or not the second argument is supplied.

Note

The values of code model elements such as classes, structs, functions, attributes, delegates, and so forth can be non-deterministic after making certain kinds of edits, meaning that their values cannot be relied upon to always remain the same. For more information, see the section Code Model Element Values Can Change in Discovering Code by Using the Code Model (Visual Basic).

.NET Framework Security

See Also

Reference

CodeElements Interface

EnvDTE Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples

Discovering Code by Using the Code Model (Visual Basic)

Discovering Code by Using the Code Model (Visual C#)