JsonIncludeAttribute 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指示应包含成员以用于序列化和反序列化。
public ref class JsonIncludeAttribute sealed : System::Text::Json::Serialization::JsonAttribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple=false)]
public sealed class JsonIncludeAttribute : System.Text.Json.Serialization.JsonAttribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple=false)>]
type JsonIncludeAttribute = class
inherit JsonAttribute
Public NotInheritable Class JsonIncludeAttribute
Inherits JsonAttribute
- 继承
- 属性
注解
应用于属性时,此属性指示非公共 getter 和 setter 可用于序列化和反序列化。
注意
即使使用此属性,序列化源生成器仍仅限于生成的代码 可访问 的非公共成员。 可访问 的非公共成员包括以下成员:
internal
如果与生成的上下文位于同一程序集中,则为 。protected
当protected internal
生成的上下文位于派生自 该类型的类中时, 或private protected
。private
如果类型与生成的上下文嵌套在相同的类中,则为 。
在 .NET 6 和 .NET 7 中,不支持非公共属性。
构造函数
JsonIncludeAttribute() |
初始化 JsonIncludeAttribute 的新实例。 |
属性
TypeId |
在派生类中实现时,获取此 Attribute 的唯一标识符。 (继承自 Attribute) |
方法
Equals(Object) |
返回一个值,该值指示此实例是否与指定的对象相等。 (继承自 Attribute) |
GetHashCode() |
返回此实例的哈希代码。 (继承自 Attribute) |
GetType() |
获取当前实例的 Type。 (继承自 Object) |
IsDefaultAttribute() |
在派生类中重写时,指示此实例的值是否是派生类的默认值。 (继承自 Attribute) |
Match(Object) |
当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。 (继承自 Attribute) |
MemberwiseClone() |
创建当前 Object 的浅表副本。 (继承自 Object) |
ToString() |
返回表示当前对象的字符串。 (继承自 Object) |
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈