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

How to serialize named tuples (C#)?


is there a best prectise how to work with named tuples in C#?

What would be the best way to serialize such a named tuple construct using ice/slice2cs:

List<(string Key, int Benchmark, List<(DateTime Date, int Count)>)>

Any help would me much appreciated.

Kind regards



  • xdm
    xdm La Coruña, Spain

    Hi Mike,

    Ice cannot directly send your named tuples, you have to use types defined in Slice, here you can probably use a couple of structs and sequences like in:

    struct BenchmarkCount
        long Data; // Send date as a long
        int Count;
    sequence<BenchmarkCount> BenchmarkCountSeq; 
    struct BenchmarkInfo
        string Key;
        int Benchmark;
        BenchmarkCountSeq Counters;
    sequence<BenchmarkInfo> BenchmarkInfoSeq;