-
Notifications
You must be signed in to change notification settings - Fork 0
Generics
Added by Jeffery Olson
part of the Boo Language Guide
The general syntax for generics in boo is id [ of ... ]
where id
is the
generic entity being declared or referenced and ...
is the list of generic
parameters or arguments. In the case of declarations, a parameter can be given
a list of constraints by following its identifier with a parenthesized list of
constraints. For example, entity [ of type (class)]
declares that entity
is a generic taking a single parameter 'type' that must be a class type.
- include foo* for IEnumerable
To specify generic arguments to a method invocation, use square brackets with
the of
keyword as in the following example where instance
is an instance
of some class with a generic method named Method
taking a single generic type
argument named Type
and a single normal argument named argument
.
instance.Method [of Type] (argument)
- Generic classes
- Generic methods