Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ToString()

override string System.Net.SocketAddress.ToString ( )
inline

Definition at line 153 of file SocketAddress.cs.

154 {
155 string text = Family.ToString();
156 int num = text.Length + 1 + 10 + 2 + (Size - 2) * 4 + 1;
157 Span<char> span = ((num > 256) ? ((Span<char>)new char[num]) : stackalloc char[256]);
158 Span<char> destination = span;
159 text.CopyTo(destination);
160 int length = text.Length;
161 destination[length++] = ':';
162 bool flag = Size.TryFormat(destination.Slice(length), out var charsWritten);
163 length += charsWritten;
164 destination[length++] = ':';
165 destination[length++] = '{';
166 byte[] buffer = Buffer;
167 for (int i = 2; i < Size; i++)
168 {
169 if (i > 2)
170 {
171 destination[length++] = ',';
172 }
173 flag = buffer[i].TryFormat(destination.Slice(length), out charsWritten);
174 length += charsWritten;
175 }
176 destination[length++] = '}';
177 return destination.Slice(0, length).ToString();
178 }

References System.Net.SocketAddress.Buffer, System.buffer, System.Span< T >.CopyTo(), System.destination, System.Net.SocketAddress.Family, System.length, System.Net.SocketAddress.Size, and System.text.

Referenced by System.Net.Sockets.SocketsTelemetry.AcceptStart().