NetworkReader: more readable syntax

This commit is contained in:
vis2k 2022-09-25 12:43:12 +07:00
parent d3ee9e325e
commit 5fa5269a11

View File

@ -23,22 +23,14 @@ public class NetworkReader
public int Position;
/// <summary>Remaining bytes that can be read, for convenience.</summary>
public int Remaining
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => buffer.Count - Position;
}
public int Remaining => buffer.Count - Position;
/// <summary>Total buffer capacity, independent of reader position.</summary>
public int Capacity => buffer.Count;
[Obsolete("NetworkReader.Length was renamed to Capacity")] // 2022-09-25
public int Length => Capacity;
/// <summary>Total buffer capacity, independent of reader position.</summary>
public int Capacity
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => buffer.Count;
}
public NetworkReader(byte[] bytes)
{
buffer = new ArraySegment<byte>(bytes);