私はかなり普通のクラスをシリアライズしたいのですが、キャッチは次のような静的クラスにネストされていることです:
public static class StaticClass
{
[Serializable]
public class SomeType
{
...
}
}
このコード:
StaticClass.SomeType obj = new StaticClass.SomeType();
XmlSerializer mySerializer = new XmlSerializer(typeof(obj));
次のエラーが発生します。
StaticClass.SomeType cannot be serialized. Static types cannot be used as parameters or return types.
そのエラーはまったく無関係のようです。StaticClass.SomeType
静的タイプではありません。
これを回避する方法はありますか?このエラーがばかげていると思うのは間違っていますか?