^ Operator in C# RRS feed

  • Question

  • Hello,

    I have two question

    1. What do do we call ^ in English and programming languages?

    2. How can ^margin and ^amountToTakeFromEnd and ^0  calculate?

    Thanks in advance

    int margin = 1;
    int[] inner = numbers[margin..^margin];
    Display(inner);  // output: 10 20 30 40
    string line = "one two three";
    int amountToTakeFromEnd = 5;
    Range endIndices = ^amountToTakeFromEnd..^0;
    string end = line[endIndices];

    • Edited by Arash_89 Wednesday, January 29, 2020 4:03 PM
    Wednesday, January 29, 2020 4:02 PM


  • The ^ character is often informally referred to as a 'hat' because that's easier to say than the more official name of 'circumflex' , and the other official name 'caret' can be confused with a text cursor. It appears that operator is in need of a meaningful name, which might come along after someone works out what the hell it's supposed to actually do.

    For goodness' sake, those people on the proposals committee are getting desperate, aren't they? It looks like they're pfaffing around creating imaginary problems because they've run out of real ones to solve.

    • Marked as answer by Arash_89 Wednesday, January 29, 2020 11:08 PM
    Wednesday, January 29, 2020 11:04 PM

All replies