Click or drag to resize

NetDataWriter Class

Inheritance Hierarchy
SystemObject
  LiteNetLib.UtilsNetDataWriter

Namespace: LiteNetLib.Utils
Assembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.2.1.0 (2026.2.1.0)
Syntax
C#
public class NetDataWriter

The NetDataWriter type exposes the following members.

Constructors
 NameDescription
Public methodNetDataWriterInitializes a new instance of the NetDataWriter class
Public methodNetDataWriter(Boolean)Initializes a new instance of the NetDataWriter class
Public methodNetDataWriter(Boolean, Int32)Initializes a new instance of the NetDataWriter class
Top
Properties
 NameDescription
Public propertyCapacity Gets the total capacity of the internal Byte buffer.
Public propertyData Gets the underlying Byte array used by this writer.
Public propertyLength Gets the current number of Bytes written to the buffer.
Top
Methods
 NameDescription
Public methodAsReadOnlySpan Returns a ReadOnlySpanT representing the currently used portion of the internal buffer.
Public methodCopyData Creates a Byte array containing the current data from the internal buffer.
Public methodEnsureFit Ensures the internal buffer can accommodate additionalSize more Bytes.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodStatic memberFromBytes(SpanByte) Creates NetDataWriter from the given bytes.
Public methodStatic memberFromBytes(Byte, Boolean) Creates NetDataWriter from existing ByteArray
Public methodStatic memberFromBytes(Byte, Int32, Int32) Creates NetDataWriter from existing ByteArray (always copied data)
Public methodStatic memberFromString Creates a new NetDataWriter and serializes a String into it.
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodPut(Boolean) Serializes a Boolean value as a single Byte.
Public methodPut(Byte) Serializes a Byte value.
Public methodPut(Byte) Serializes an entire Byte array.
Public methodPut(Char) Serializes a Char value as a UInt16.
Public methodPut(Double) Serializes a Double value.
Public methodPut(Guid) Serializes a Guid value.
Public methodPut(Int16) Serializes a Int16 value.
Public methodPut(Int32) Serializes an Int32 value.
Public methodPut(Int64) Serializes a Int64 value.
Public methodPut(IPEndPoint) Serializes an IPEndPoint.
Public methodPut(ReadOnlySpanByte) Serializes a ReadOnlySpanT of Bytes to the internal buffer.
Public methodPut(SByte) Serializes an SByte value.
Public methodPut(Single) Serializes a Single value.
Public methodPut(UInt16) Serializes a UInt16 value.
Public methodPut(UInt32) Serializes a UInt32 value.
Public methodPut(UInt64) Serializes a UInt64 value.
Public methodPut(String, Int32) Serializes a string using a 2-byte UInt16 length header.
Public methodPut(Byte, Int32, Int32) Serializes a segment of a Byte array.
Public methodPutT(T) Serializes an object implementing INetSerializable.
Public methodPutArray(Boolean) Serializes an array of unmanaged values to the internal buffer.
Public methodPutArray(Double) Serializes an array of unmanaged values to the internal buffer.
Public methodPutArray(Int16) Serializes an array of unmanaged values to the internal buffer.
Public methodPutArray(Int32) Serializes an array of unmanaged values to the internal buffer.
Public methodPutArray(Int64) Serializes an array of unmanaged values to the internal buffer.
Public methodPutArray(Single) Serializes an array of unmanaged values to the internal buffer.
Public methodPutArray(String) Serializes an array of String values.
Public methodPutArray(UInt16) Serializes an array of unmanaged values to the internal buffer.
Public methodPutArray(UInt32) Serializes an array of unmanaged values to the internal buffer.
Public methodPutArray(UInt64) Serializes an array of unmanaged values to the internal buffer.
Public methodPutArray(Array, Int32) Serializes an Array prefixed with a 2-byte UInt16 length.
Public methodPutArray(String, Int32) Serializes an array of String values with a maximum length constraint per element.
Public methodPutArrayT(T) Serializes an array of objects implementing INetSerializable.
Public methodPutBytesWithLength(Byte) Serializes a Byte array prefixed with its UInt16 length.
Public methodPutBytesWithLength(Byte, Int32, UInt16) Serializes a segment of a Byte array prefixed with its UInt16 length.
Public methodPutEnumT Writes an enum value of type T to the internal data buffer at the current position.
Automatically resizes the buffer if _autoResize is enabled. Advances the position by the size of T.
Public methodPutLargeString Serializes a String using a 4-byte Int32 length header.
Public methodPutNullableUnmanagedT Writes a nullable value of type T into the internal byte buffer at the current position, first writing a Boolean indicating whether the value is present, and then writing the value itself if it exists.
Advances the position by 1 byte for the presence flag plus the size of T if the value is present.
Public methodPutSBytesWithLength(SByte) Serializes an SByte array prefixed with its UInt16 length.
Public methodPutSBytesWithLength(SByte, Int32, UInt16) Serializes a segment of an SByte array prefixed with its UInt16 length.
Public methodPutSpanT Serializes a SpanT of unmanaged values to the internal buffer.
Public methodPutUnmanagedT Writes a value of type T into the internal byte buffer at the current position, advancing the position by the size of T.
Public methodPutUnmanagedArrayT Serializes an array of unmanaged values.
Public methodReset Resets the _position to 0, effectively clearing the buffer for reuse.
Public methodReset(Int32) Resets the _position to 0 and ensures the internal buffer has at least the specified size.
Public methodResizeIfNeed Ensures the internal buffer is at least newSize.
Public methodSetPosition Sets position of NetDataWriter to rewrite previous values
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Fields
 NameDescription
Protected field_data 
Protected field_position 
Top
Extension Methods
 NameDescription
Public Extension MethodMethodInvoke Calls the object method by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGet Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertyGetT Gets the value of the object property by name.
(Defined by ObjectEx)
Public Extension MethodPropertySet Sets the value of the object property by name.
(Defined by ObjectEx)
Top
See Also