IgnoreAttribute Class
Definition
- Namespace
- Bodu.Text.Serialization
- Assembly
- Bodu.Text.Serialization.dll
- Package
- Bodu.Text.Serialization 1.0.0
- Source
- IgnoreAttribute.cs
Excludes a property or field from serialization, either unconditionally or under the condition given by Condition.
[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class IgnoreAttribute : SerializationAttribute
- Inheritance
-
IgnoreAttribute
- Attributes
-
System.AttributeUsageAttribute
- Inherited Members
- Extension Methods
Examples
public sealed class Account
{
[Ignore]
public string? Secret { get; set; }
[Ignore(Condition = IgnoreCondition.WhenWritingNull)]
public string? Comment { get; set; }
}
// Secret is never written; Comment is written only when it is non-null.
Constructors
IgnoreAttribute()
public IgnoreAttribute()
Properties
Condition
Gets or sets the condition under which the member is ignored.
public IgnoreCondition Condition { get; set; }
Property Value
- IgnoreCondition
The ignore condition; Always by default.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |