Skip to content

Commit

Permalink
Updated ExampleClass
Browse files Browse the repository at this point in the history
  • Loading branch information
abledbody committed Aug 27, 2023
1 parent a25ef8a commit ad9d2f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Assets/QuickBin/ExampleClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Serializer Serialize(Serializer buffer) =>
.Write(id)
.Write(velocity);

public static Deserializer Deserialize(Deserializer buffer, out ExampleClass produced) {
public static Deserializer Deserialize(Deserializer buffer, out ExampleClass produced) =>
// Thanks to the "out" keyword, you can inline the declaration of variables,
// and immediately use them in the next method call.

Expand All @@ -41,10 +41,10 @@ public static Deserializer Deserialize(Deserializer buffer, out ExampleClass pro
buffer.Read(out int nameLength)
.Read(out string name, nameLength)
.Read(out short id)
.Read(out Vector2 velocity);
produced = new(name, id, velocity);
return buffer;
}
.Read(out Vector2 velocity)
// The Return method is a convenience method that allows for expression bodies like this.
// All it does is spit back out what you put in.
.Return(new(name, id, velocity), out produced);

// Note that this is not necessarily a smart way to do a Clone,
// but it's a good example of how to use QuickBin at the top level.
Expand Down

0 comments on commit ad9d2f7

Please sign in to comment.