Skip to content

Commit

Permalink
add NetDataReader.Get<T>(out...)
Browse files Browse the repository at this point in the history
  • Loading branch information
RevenantX committed Aug 9, 2023
1 parent 4c2e7b1 commit 7c38d4c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions LiteNetLib/Utils/NetDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ public NetDataReader(byte[] source, int offset, int maxSize)

#region GetMethods

public void Get<T>(out T result) where T : struct, INetSerializable
{
result = default(T);
result.Deserialize(this);
}

public void Get<T>(out T result, Func<T> constructor) where T : class, INetSerializable
{
result = constructor();
result.Deserialize(this);
}

public void Get(out IPEndPoint result)
{
result = GetNetEndPoint();
Expand Down

0 comments on commit 7c38d4c

Please sign in to comment.