Menu

Type aliases

Will Pittenger

A type alias is just a shortcut to provide you with less typing. Instead of typing Generic1<Generic2<Generic3<MyType>, int, string>, float, IComparble<MyType>> in fifteen places, you could create a type alias called MyExpandedGeneric. The syntax is simple.

typealias MyExpandedGeneric Generic1<Generic2<Generic3<MyType>, int, string>, float, IComparble<MyType>>

var MyExpandedGeneric myAliasInstance = new MyExpandedGeneric

If you don't know the type to pass one of a generic your alias is making use of, you can make the alias a generic.

typealias <WhichType> MyExpandedGenericGeneric1<Generic2<Generic3<WhichType>, int, string>, float, IComparble<WhichType>>

var MyExpandedGeneric<MyType> myAliasInstance = new MyExpandedGeneric<MyType>

Related

Wiki: By value versus by reference
Wiki: Home
Wiki: Keywords
Wiki: Reflection
Wiki: keywords-out
Wiki: keywords-typealias