using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
public static void Main()
var dict = new Dictionary<int, RClass>();
dict.Add(1, new RClass { Content = "bb" });
RClass resp;
dict.TryGetValue(
2,
out resp
);
//Console.Write(resp.Content); // => "Object reference not set to an instance of an object."
Console.Write(dict[2]); // => "The given key was not present in the dictionary."
var list = new List<RClass>();
list.Add(new RClass
Id = 1,
Content = "ddd"
});
Content = "ddd2"
//list.ToDictionary(d => d.Id, d => d.Content); // => "An item with the same key has already been added."
}
public class RClass
public int Id { get; set; }
public string Content { get; set; }