concept range in category c#

appears as: rge, range, Rge, rges, A rge, rges
C# in Depth, Fourth Edition

This is an excerpt from Manning's book C# in Depth, Fourth Edition.

8At least until it overflows the range of int. At that point, it might throw an exception or underflow to a large negative number depending on whether the code is in a checked context.

  • Range is a pair of indexes: one for the start of the range and one for the end.
  • Listing 15.15. Using indexer overloads for index and range in a string and a span
    string text = "hello world";
    Console.WriteLine(text[2]);                                  #1
    Console.WriteLine(text[^3]);                                 #2
    Console.WriteLine(text[2..7])                                #3
    
    Span<int> span = stackalloc int[] { 5, 2, 7, 8, 2, 4, 3 };
    Console.WriteLine(span[2]);                                  #4
    Console.WriteLine(span[^3]);                                 #5
    Span<int> slice = span[2..7];                                #6
    Console.WriteLine(string.Join(", ", slice.ToArray()));
    ASP.NET 4.0 in Practice

    This is an excerpt from Manning's book ASP.NET 4.0 in Practice.

    Listing 5.9. Specifying a range using the RangeExpression control to filter results