IceRPC Logo
Docs
  • Getting Started
  • IceRPC
  • Slice
  • Protobuf
  • IceRPC for Ice users
  • API Reference
  1. Slice
  2. Encoding reference
  • Overview
    • Basics

      • Slice components
      • Contract first model
      • Slice files
      • Examples
    • Language guide

      • Compilation mode
      • Module
      • Interface
      • Operation
      • Fields
      • Parameters
      • Primitive types
      • Enum types
      • Struct types
      • Class types
      • Exception
      • Sequence types
      • Dictionary types
      • Custom types
      • Well-known types
      • Using proxies as Slice types
      • Type alias
      • Attributes
      • Comments and doc comments
      • Preprocessor directives
    • Encoding reference

      • Overview
      • Encoding-only constructs
      • Primitive types
      • User-defined types
      • Constructed types
      • Operation arguments and return values
      • Exceptions
      • IceRPC + Slice integration
  1. Slice
  2. Encoding reference

2 min read

Constructed types

Learn how to encode constructed types with Slice.

Dictionary

A dictionary with N entries is encoded like a sequence with N elements where the element type is a compact struct:

slice
compact struct Pair { key: Key, value: Value }

Key represents the dictionary's key type and Value represents the dictionary's value type.

PreviousUser-defined types
NextOperation arguments and return values

Was this page helpful?

On this page

  • Dictionary
  • Sequence
  • Example: empty sequence
  • Example: sequence of int32

Actions

  • Edit this page
  • GitHub Discussions
© 2025 ZeroC
  • About
  • Privacy Policy
  • Contact