Tuesday, 13 August 2019

Cheh: Data Binding in C#

  • In expressions with the null-conditional operators ?. and ?[], you can use the null-coalescing operator to provide an alternative expression to evaluate in case the result of the expression with null-conditional operations is null:
    C#
    double SumNumbers(List<double[]> setsOfNumbers, int indexOfSetToSum)
    {
        return setsOfNumbers?[indexOfSetToSum]?.Sum() ?? double.NaN;
    }
    
    var sum = SumNumbers(null, 0);
    Console.WriteLine(sum);  // output: NaN
CHEH:

LIFO(Last in First Out): Stack Collection we will use.

No comments:

Post a Comment