97
1
using System;
2
using System.Collections;
3
using System.Collections.Generic;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
Console.WriteLine("Hello World");
10
11
#region Contravarient Usage Types
12
13
//Type 1 - Passing objects
14
Toyota MyCar = new Toyota();
15
Honda MyWifeCar = new Honda();
16
Console.WriteLine("============================");
17
ShowColor(MyCar); //Contravarient
18
ShowColor(MyWifeCar); //Contravarient
19
20
//Type 2 - Passing List<Objects>
21
List<Car> mycars = new List<Car>();
22
mycars.Add(MyCar);
23
mycars.Add(MyWifeCar);
24
Console.WriteLine("============================");
Cached Result
Distinct() on both values
(1, 12)
(1, 2)
(1, 18)
(2, 12)
GroupBy() second value
(1, 12)
(1, 2)
(1, 18)
(1, 12)
(1, 2)
(1, 18)
(2, 12)
GroupBy() second value
(1, 12)
(1, 2)
(1, 18)