Archived

This forum has been archived. Please start a new discussion on GitHub.

nullable slice definitions?

Hi,

I'm unable to find in the documentation how to define nullable types in slice. Can someone please show my an example?

Ideally I would like to end up with a

public int? myint; in c#

Many thanks,

Filip

Comments

  • benoit
    benoit Rennes, France
    Hi,

    It's not possible to specify nullable types with Slice and map them to C# nullables.

    Ice 3.5 (currently in beta) will provide "optional" members and parameters which you could eventually use instead to specify nullables. Optionals are not mapped to nullables types in C# however. See here for more information on the C# mapping of Slice optionals.

    Another possibility is to map the nullable types to Slice classes, for example:
    // Slice
    class NullableInt 
    {
        int value;   
    };
    

    Cheers,
    Benoit.