UtilityEx.GetUnusedBlockName<T> Method

Gets a new name for block creation adding a number as suffix to the original name to avoid duplicates block names.
Public Shared Function GetUnusedBlockName(Of  _ 
T As {Block, IKeyedCollectionDisposableItem(Of T)})( _ 
ByVal name As String, _ 
ByVal blocks As BlockKeyedCollection(Of T), _ 
Optional ByVal addCounterOnlyIfNeeded As Boolean = false _ 
) As String
This language is not supported or no code example is available.
public static string GetUnusedBlockName<T>( 
string name
BlockKeyedCollection<T> blocks
bool addCounterOnlyIfNeeded = false 

where T : Block, IKeyedCollectionDisposableItem<T>
This language is not supported or no code example is available.

Type Parameters

T

The Block item belong to the collection.

Parameters

name
string

The original name to start from.

blocks
BlockKeyedCollection<T>

The blocks collection.

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 block not already contained in the blocks collection.

.NET Framework

Supported in: 4.8

In this article

Definition