1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| class Program { static void Main(string[] args) {
IEnumerable<string> strings = new List<string> { "a", "b", "c" }; IEnumerable<object> objects = strings;
IList<string> strings1 = new List<string> { "a", "b", "c" }; IList<object> objects1 = (IList<object>)strings; objects1.Add(new object()); string element = strings1[3]; Console.WriteLine(element); object o = new object();
Action<object> objAction = obj => Console.WriteLine(obj); Action<string> strAction = objAction; objAction("Print me"); } }
|