views:

50

answers:

0

I'd like to map Foo[,] to Foo[][] and back. There are simple solutions using loops, but isn't there something more elegant?

In my specific case, this is required in this scenario:

[DataContract]
class A
{
    // can't serialize this thingy
    private readonly Foo[,] _Foo;

    [DataMember]
    private Foo[][] SerializableFoo {
        get {
            // map here
        }
        set {
            // map here
        }
    }
}

I'm aware there are advanced solutions using IDataContractSurrogate but this seems to be overkill in my case.