Table of Contents Previous Next
Logo
Client-Side Slice-to-C# Mapping : 14.3 Mapping for Identifiers
Copyright © 2003-2010 ZeroC, Inc.

14.3 Mapping for Identifiers

Slice identifiers map to an identical C# identifier. For example, the Slice identifier Clock becomes the C# identifier Clock. If a Slice identifier is the same as a C# keyword, the corresponding C# identifier is a verbatim identifier (an identifier prefixed with @). For example, the Slice identifier while is mapped as @while.1
The Slice-to-C# compiler generates classes that inherit from interfaces or base classes in the .NET framework. These interfaces and classes introduce a number of methods into derived classes. To avoid name clashes between Slice identifiers that happen to be the same as an inherited method, such identifiers are prefixed with ice_ and suffixed with _ in the generated code. For example, the Slice iden­tifier Clone maps to the C# identifier ice_Clone_ if it would clash with an inherited Clone. The complete list of identifiers that are so changed is:
Note that Slice identifiers in this list are translated to the corresponding C# identi­fier only where necessary. For example, structures do not derive from ICloneable, so if a Slice structure contains a member named Clone, the corre­sponding C# structure’s member is named Clone as well. On the other hand, classes do derive from ICloneable, so, if a Slice class contains a member named Clone, the corresponding C# class’s member is named ice_Clone_.
Also note that, for the purpose of prefixing, Slice identifiers are case-insensi­tive, that is, both Clone and clone are escaped and map to ice_Clone_ and ice_clone_, respectively.

1
As suggested in Section 4.5.3 on page 92, you should try to avoid such Slice identifiers as much as possible.


Table of Contents Previous Next
Logo