UtilityEx.GetUnusedLayerName Method

Gets a new name for layer adding a number as suffix to the original name to avoid duplicates layer names.
Public Shared Function GetUnusedLayerName( _ 
ByVal name As String, _ 
ByVal layers As LayerKeyedCollection, _ 
Optional ByVal addCounterOnlyIfNeeded As Boolean = false _ 
) As String
This language is not supported or no code example is available.
public static string GetUnusedLayerName( 
string name
LayerKeyedCollection layers
bool addCounterOnlyIfNeeded = false 
)
This language is not supported or no code example is available.

Parameters

name
string

The original name to start from.

layers
LayerKeyedCollection

addCounterOnlyIfNeeded
bool

When true, the original name is preserved if not used yet, otherwise, the new name counter starts from 1 searching for a non duplicated name.

Return Value

string

The name that can be used to create a new layer not already contained in the layers collection.

.NET Framework

Supported in: 4.8

In this article

Definition