Skip to content

Commit

Permalink
Merge pull request MessagePack-CSharp#1110 from neuecc/support-record
Browse files Browse the repository at this point in the history
record note to ReadMe
  • Loading branch information
neuecc committed Nov 12, 2020
2 parents e03f2aa + 433774b commit ba85be1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,16 @@ public struct Point
}
```

C# 9.0 record with primary constructor is similar immutable object, also supports serialize/deserialize.

```csharp
// use key as property name
[MessagePackObject(true)]public record Point(int X, int Y);

// use property: to set KeyAttribute
[MessagePackObject] public record Point([property:Key(0)] int X, [property: Key(1)] int Y);
```

## Serialization Callback

Objects implementing the `IMessagePackSerializationCallbackReceiver` interface will received `OnBeforeSerialize` and `OnAfterDeserialize` calls during serialization/deserialization.
Expand Down

0 comments on commit ba85be1

Please sign in to comment.