Question

I am trying to serialize an object to Azure Mobile Services.

The object contains an array of a second object which should also be serialized.

[DataContract()]
class ObjectA
{
    [DataMember(Name= "id")]
    public int Id { get; set; }

    [DataMember(Name = "info")]
    public string info{ get; set; }

    [DataMember(Name = "collectionOfB")]
    public ObjectB[] myArrayOfB{ get; set; }
}

[DataContract()]
class ObjectB
{
    [DataMember(Name= "id")]
    public int Id { get; set; }

    [DataMember(Name = "info")]
    public string info{ get; set; }
}

I have loaded both table's properly and can insert an individual item into each of the tables.

However when I call the InsertAsync method on the table for objectA I receive an error

Cannot serialize member 'myArrayOfB' of type 'namespace.ObjectB[]' declared on type 'ObjectA'

Any idea's on what I need to do to fix this?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top