This page offers a quick overview of the Slice syntax through examples.
Interfaces
slice
module Example
interface Widget { spin(count: int32)}
// An interface can extend one or more other interfacesinterface Gizmo : Widget { walk(direction: Direction)}
Operations
Enums
Structs
Sequences and dictionaries
slice
module Example
interface Dns { resolveName(name: string) -> Sequence<IPAddress>}
interface Census { getCityPopulation(state: string) -> Dictionary<string, int32>}
Custom and well-known types
Attributes
slice
[cs::namespace("AttributeExample")]module Example
[cs::identifier("WorldAtlas")]interface Atlas { getMainCities(country: string) -> [cs::type("HashSet<string>")] Sequence<string>}
[cs::readonly]compact struct Point { x: int32, y: int32 }