Web API アプリケーションで DataContractSerializer を使用しており、アクションで以下のようにデータ型を返しています。
public class Event
{
public string Name {get; set;}
public IList<Division> Divisions {get;set;}
}
シリアル化すると、以下の xml が返されます。
<Event xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07
/EventTypeNameSpace">
<Name>some name</Name>
<Divisions i:nil="true" />
</Event>
1) 2 つの xmlns:i および xmlns 属性を返すのはなぜですか? どうすればそれらを除外できますか?
2) null の場合、部門を xml から除外するにはどうすればよいですか?