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

◆ AsMemory() [2/5]

static ReadOnlyMemory< char > System.MemoryExtensions.AsMemory ( this string? text,
Index startIndex )
inlinestatic

Definition at line 438 of file MemoryExtensions.cs.

439 {
440 if (text == null)
441 {
442 if (!startIndex.Equals(Index.Start))
443 {
444 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.text);
445 }
446 return default(ReadOnlyMemory<char>);
447 }
448 int offset = startIndex.GetOffset(text.Length);
449 if ((uint)offset > (uint)text.Length)
450 {
451 ThrowHelper.ThrowArgumentOutOfRangeException();
452 }
453 return new ReadOnlyMemory<char>(text, offset, text.Length - offset);
454 }

References System.offset, System.Index.Start, System.startIndex, System.text, System.ThrowHelper.ThrowArgumentNullException(), and System.ThrowHelper.ThrowArgumentOutOfRangeException().