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

◆ AppendFormatted< T >() [4/4]

Definition at line 116 of file MemoryExtensions.cs.

117 {
119 {
121 }
122 string text;
123 if (value is IFormattable)
124 {
125 if (value is ISpanFormattable)
126 {
127 if (((ISpanFormattable)(object)value).TryFormat(_destination.Slice(_pos), out var charsWritten, format, _provider))
128 {
130 return true;
131 }
132 return Fail();
133 }
134 text = ((IFormattable)(object)value).ToString(format, _provider);
135 }
136 else
137 {
138 text = value?.ToString();
139 }
140 if (text != null)
141 {
142 return AppendStringDirect(text);
143 }
144 return true;
145 }
Span< T > Slice(int start)
Definition Span.cs:271

References System.MemoryExtensions.TryWriteInterpolatedStringHandler._destination, System.MemoryExtensions.TryWriteInterpolatedStringHandler._hasCustomFormatter, System.MemoryExtensions.TryWriteInterpolatedStringHandler._pos, System.MemoryExtensions.TryWriteInterpolatedStringHandler._provider, System.MemoryExtensions.TryWriteInterpolatedStringHandler.AppendStringDirect(), System.MemoryExtensions.TryWriteInterpolatedStringHandler.Fail(), System.format, System.Span< T >.Slice(), System.text, System.ToString, and System.value.