异常处理

using System;
using System.Collections.Generic;

var numbers = new Dictionary<intstring> {
    [1] = "one",
    [2] = "two",
    [3] = null
};

var three = numbers[3] ?? throw new Exception("no such element");

Console.WriteLine(three);