.NET, C#: How to add a custom serialization attribute that acts as ISerializable interface

后端 未结 2 1536
旧时难觅i
旧时难觅i 2021-01-03 04:39

I am doing some serialization of db linq objects, which contain EntitySet and EntityRef classes.

I found a pretty easy way to deal with serialization of these classe

2条回答
  •  Happy的楠姐
    2021-01-03 05:09

    Unfortunately no, ISerializable is an interface designed to allow you to control the serialization process while the SerializableAttribute is just a marker that says "this class can be serialized". However, you could look into something like PostSharp to add this functionality (take a look at the CompositionAspect).

提交回复
热议问题