Type alias

Understand how to create an alias for a Slice type.

You can use a typealias to give a new name to an existing type or typealias. For example:

// Greeting is now another name for string
typealias Greeting = string

It is common to create a typealias to shorten a type with one or more attributes. For example:

typealias StringSet = [cs::type("HashSet<string>")] Sequence<string>

A typealias is not mapped to anything in C#. The Slice compiler generates code as if the typealias was replaced by its underlying type (including attributes, if any).

Was this page helpful?