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

◆ ToString() [3/3]

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

Definition at line 167 of file SocketAddress.cs.

168 {
169 string text = Family.ToString();
170 int num = text.Length + 1 + 10 + 2 + (Size - 2) * 4 + 1;
171 Span<char> span = ((num > 256) ? ((Span<char>)new char[num]) : stackalloc char[256]);
172 Span<char> destination = span;
173 text.CopyTo(destination);
174 int length = text.Length;
175 destination[length++] = ':';
176 bool flag = Size.TryFormat(destination.Slice(length), out var charsWritten);
177 length += charsWritten;
178 destination[length++] = ':';
179 destination[length++] = '{';
180 byte[] buffer = Buffer;
181 for (int i = 2; i < Size; i++)
182 {
183 if (i > 2)
184 {
185 destination[length++] = ',';
186 }
187 flag = buffer[i].TryFormat(destination.Slice(length), out charsWritten);
188 length += charsWritten;
189 }
190 destination[length++] = '}';
191 return destination.Slice(0, length).ToString();
192 }

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