Class UniqueNameGenerator

Used to generate unique names for items, for instance when copying an item.

Inheritance
System.Object
UniqueNameGenerator
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Framework
Assembly: EPiServer.Framework.dll
Version: 8.11.0
Syntax
public static class UniqueNameGenerator

Methods

GenerateCopyName(String, Func<String, Boolean>)

Generates a copy name of an item.

Declaration
public static string GenerateCopyName(string originalName, Func<string, bool> nameExists)
Parameters
Type Name Description
System.String originalName

The original name

System.Func<System.String, System.Boolean> nameExists

The name exists test function

Returns
Type Description
System.String

GenerateUniqueName(String, Func<String, Boolean>)

Generates an unique name of an item.

Declaration
public static string GenerateUniqueName(string intendedName, Func<string, bool> nameExists)
Parameters
Type Name Description
System.String intendedName

The intended name.

System.Func<System.String, System.Boolean> nameExists

The name exists test function

Returns
Type Description
System.String

GenerateUniqueName(String, String, Int32, Func<String, Boolean>)

Generates an unique name of an item.

Declaration
public static string GenerateUniqueName(string intendedName, string suffixPattern, int startCounter, Func<string, bool> nameExists)
Parameters
Type Name Description
System.String intendedName

The intended name.

System.String suffixPattern

The pattern used to generate an unique suffix, in which {0} is preserved for the counter

System.Int32 startCounter

Start value of the counter

System.Func<System.String, System.Boolean> nameExists

The name exists test function

Returns
Type Description
System.String