@@ -16,6 +16,7 @@ applications.
16
16
17
17
With Ice, the version of the Ice encoding to use when sending a request is a runtime decision. You can reconfigure a
18
18
proxy to use the version of your choice. For example:
19
+
19
20
``` csharp {% title="Setting the Ice encoding version with Ice for C#" %}
20
21
helloPrx = helloPrx .ice_encodingVersion (Ice .Util .Encoding_1_0 );
21
22
```
@@ -27,12 +28,14 @@ With the new Slice language, the encoding to use is decided at build-time, when
27
28
define an interface, the encoding for operation arguments and return values is specified unambiguously with the
28
29
[ mode statement] ( /slice1/language-guide/compilation-mode ) , and gets hard-coded in the generated code.
29
30
30
- #### Example
31
+ ### Example
31
32
32
33
``` slice
33
34
mode = Slice1
34
35
```
36
+
35
37
or
38
+
36
39
``` slice
37
40
mode = Slice2
38
41
```
@@ -46,19 +49,20 @@ A Slice file that doesn't specify a compilation mode uses the default mode: Slic
46
49
47
50
The compilation mode also determines which definitions are allowed in your Slice file.
48
51
49
- #### Slice1
52
+ ### Slice1
50
53
51
54
This mode provides an equivalent syntax for all Slice definitions in the .ice syntax, including classes, exceptions,
52
55
interfaces, and structs. The names are mostly the same: for example, a class in a ` .ice ` file corresponds to a
53
56
class in a ` .slice ` file, and a struct in a ` .ice ` file corresponds to a compact struct in a ` .slice ` file.
54
57
55
58
You should use this mode when (and only when) you need to send or receive requests to and from Ice applications.
56
59
57
- #### Slice2
60
+ ### Slice2
58
61
59
62
This is the default mode and the preferred mode when you don't need interop with Ice applications.
60
63
61
64
This mode allows you to mark any type as optional with the ` ? ` suffix. For example:
65
+
62
66
``` slice
63
67
// Implicitly uses `mode = Slice2`
64
68
@@ -69,25 +73,28 @@ interface Translator {
69
73
```
70
74
71
75
Slice2 also provides:
72
- - stream parameters
73
- - unsigned integer types such as uint32
74
- - variable-size integer types such as varint64
75
- - underlying types for enums
76
- - structs that can be augmented while maintaining on-the-wire compatibility
77
76
78
- However, Slice2 is not a superset of Slice1. The following constructs are only accepted in Slice1 mode:
79
- - classes, including AnyClass
80
- - exceptions
77
+ - stream parameters
78
+ - unsigned integer types such as uint32
79
+ - variable-size integer types such as varint64
80
+ - underlying types for enums
81
+ - structs that can be augmented while maintaining on-the-wire compatibility
82
+
83
+ However, Slice2 is not a superset of Slice1. The following constructs are only accepted in Slice1 mode
84
+
85
+ - classes, including AnyClass
86
+ - exceptions
81
87
82
88
## New constructs
83
89
84
90
The .slice syntax adds a few constructs that are available with both Slice1 and Slice2 but have no equivalent with the
85
91
.ice syntax, namely:
86
- - anonymous sequences and dictionaries\
87
- You can now use ` Sequence<string> ` directly as a parameter or field type.
88
- - custom types\
89
- A custom type is a type that you encode and decode yourself in all language mappings.
90
- - typealias\
91
- A typealias is a new name for another type.
92
+
93
+ - anonymous sequences and dictionaries\
94
+ You can now use ` Sequence<string> ` directly as a parameter or field type.
95
+ - custom types\
96
+ A custom type is a type that you encode and decode yourself in all language mappings.
97
+ - typealias\
98
+ A typealias is a new name for another type.
92
99
93
100
[ convert ] : converting-ice-into-slice
0 commit comments