NonSerialized attribute on a constant
问题 Browsing .NET Reference source for some details on ClaimsIdentity class I noticed this: [NonSerialized] const string PreFix = "System.Security.ClaimsIdentity."; [NonSerialized] const string ActorKey = PreFix + "actor"; What might be a possible reason to use NonSerializedAttribute on a const ? 回答1: const values are serializable unless they have the NonSerializedAttribute attached to them. Whoever wrote that code, decided they didn't want to have those values serialized. Read the MSDN docs on