Skip to main content

Class StringExtensions

Inheritance
System.Object
Inherited Members
Show
Syntax
public static class StringExtensions

Properties

MaxStringLength

Maximum number of bytes a string can be serialized to. This is to avoid allocation attack. Defaults MTU, 1300 NOTE: this is byte size after Encoding IMPORTANT: Setting this property will resize the internal buffer. Do not call in hotpath. It is best to call once when you start the application

Declaration
public static int MaxStringLength { get; set; }

Methods

WriteString(NetworkWriter, String)

Declaration
public static void WriteString(this NetworkWriter writer, string value)
Parameters
TypeNameDescription
Mirage.Serialization.NetworkWriterwriter
System.Stringvaluestring or null

ReadString(NetworkReader)

Declaration
public static string ReadString(this NetworkReader reader)
Parameters
TypeNameDescription
Mirage.Serialization.NetworkReaderreader
Returns
TypeDescription
System.Stringstring or null

WriteString(NetworkWriter, String, Encoding)

Declaration
public static void WriteString(this NetworkWriter writer, string value, Encoding encoding)
Parameters
TypeNameDescription
Mirage.Serialization.NetworkWriterwriter
System.Stringvaluestring or null
System.Text.EncodingencodingUse this for encoding other than the default (UTF8). Make sure to use same encoding for ReadString

ReadString(NetworkReader, Encoding)

Declaration
public static string ReadString(this NetworkReader reader, Encoding encoding)
Parameters
TypeNameDescription
Mirage.Serialization.NetworkReaderreader
System.Text.EncodingencodingUse this for encoding other than the default (UTF8). Make sure to use same encoding for WriterString
Returns
TypeDescription
System.Stringstring or null