首页 > 开发 > 综合 > 正文

IDesign C#编码规范(之七)

2024-07-21 02:18:48
字体:
来源:转载
供稿:网友
4.3序列化 serialization
1.总是标记未封装的类为[serializable]
always mark non-sealed classes as serializable.
2.总是标记未序列化的成员变量为[non-serializable]
always mark un-serializable member variables as non-serializable.
3.总是标记序列化类中的委托为[nonserialized]
always mark delegates on a serialized class as non- serializable fields.
[serializable]
public class myclass
{
[field: nonserialized]
public event eventhandler myevent;
}
,欢迎访问网页设计爱好者web开发。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表