常量的非序列化属性 [英] NonSerialized attribute on a constant
本文介绍了常量的非序列化属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有关 的某些详细信息,请浏览.NET参考源.我注意到了ClaimsIdentity
类:
[NonSerialized]
const string PreFix = "System.Security.ClaimsIdentity.";
[NonSerialized]
const string ActorKey = PreFix + "actor";
在 const
上使用 NonSerializedAttribute
可能是什么原因?
What might be a possible reason to use NonSerializedAttribute
on a const
?
推荐答案
Const适用于整个类,与实例无关.
Const are for whole class and not tied with instance.
这篇关于常量的非序列化属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文