Udostępnij za pośrednictwem


CodeElements.CreateUniqueID(String, String) Method

Definition

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

public:
 bool CreateUniqueID(System::String ^ Prefix, [Runtime::InteropServices::Out] System::String ^ % NewName);
bool CreateUniqueID(std::wstring const & Prefix, [Runtime::InteropServices::Out] std::wstring const & & NewName = 0);
[System.Runtime.InteropServices.DispId(5)]
public bool CreateUniqueID (string Prefix, out string NewName = 0);
[System.Runtime.InteropServices.DispId(5)]
public bool CreateUniqueID (string Prefix, out string NewName);
[<System.Runtime.InteropServices.DispId(5)>]
abstract member CreateUniqueID : string * string -> bool
Public Function CreateUniqueID (Prefix As String, Optional ByRef NewName As String = 0) As Boolean
Public Function CreateUniqueID (Prefix As String, ByRef NewName As String) As Boolean

Parameters

Prefix
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
String

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

Returns

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

Attributes

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).

Applies to