List<T>
追加のカスタム プロパティから継承する、またはICollection<T>
追加のカスタム プロパティを使用してカスタム コレクションを作成する際の問題について認識しています。
public class MyCollection: List<int>
{
public string MyCustomProperty { get; set; }
}
私が知っているように、そのようなコレクションは ArrayOfInt としてスロー WCF に渡され、WCF はカスタム プロパティをシリアル化しません。解決策は、内部でコレクションを管理し、カスタム プロパティを持つラッパー クラスを作成することです。
私は自分のニーズに合わせてより良い回避策を作りたいと思っています...IEnumerable<T>
同じ問題がありますか?
public class MyCollection: IEnumerable<int>
{
/**************/
/* Code that implements IEnumerable<int> and manages the internal List<T> */
/* I know I will not able to cast it to List<T>, but I don't need it. */
/* If I will need it, I will implement cast operators later */
/**************/
public string MyCustomProperty { get; set; }
}
上記のクラスは WCF に MyCustomProperty 値を含めてスローしますか?
ありがとう