WCF DataContractSerializeを使用してシリアル化するプロジェクトがあります。私は、ベースラインとしてシリアル化結果を取る必要があるので、私はハードコード部Serialization.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9d77cc7ad89668eb
をしたくない クラスのフィールドpublic IList<Simple> List2;
をシリアル化するとき、それは常に複雑なAssemblyQualifiedNameを生成しないでIList <T>フィールドをシリアル化する方法?
<a:List2 z:Id="536" i:type="b:System.Collections.Generic.List`1[[SerializationTypes.Simple, Serialization.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9d77cc7ad89668eb]]" z:Size="2" >
<c:Simple z:Ref="525" i:nil="true"/>
<c:Simple z:Ref="534" i:nil="true"/>
</a:List2>
に生成するには、その結果に存在します。これはフィールドにgenericType
のアセンブリ修飾名であるためです。だから私はそれを変更する方法を見つけることができません。
解決方法を見つけることができますか?
[DataContract(IsReference = true)]
public class Collection2
{
[DataMember]
public IList<Simple> List2;
}
[DataContract(IsReference = true)]
public class Simple
{
[DataMember]
public string Data;
public Simple() { }
}
感謝を。私はこの方法を試みました。このアイデアは私にとって非常に役に立ちます。私はIEnumerable、ICollection 、IDictionary 、IList フィールドでそれを行います。 –
BOBO