示例#1
0
        static void Main(string[] args)
        {
            //var dict = new Dictionary<string, Studente>();
            //Studente st = new Studente();
            //Persona p = st;

            //Pair p = new Pair("ciccio", true);

            //string f = (string)p.First;

            //var ps = new PairOfString("ciccio", "pippo");

            //PairOf<string, bool> pairOfStringAndBool
            //    = new PairOf<string, bool>();

            MeteoStationDelegate m = new MeteoStationDelegate();

            var d1 = new ForecastDisplay();
            var d2 = new AverageConditionsDisplay();

            m.AddDisplay(d1.Update);
            m.AddDisplay(d2.Update);

            m.Start();
        }
示例#2
0
        static void Main(string[] args)
        {
            MeteoStationDelegate m = new MeteoStationDelegate();

            var d1 = new ForecastDisplay();
            var d2 = new AverageConditionDisplay();

            m.AddDisplay(d1.Update);        // Non si evoca il metodo Update ma l'indirizzo del metodo delegato, per questo non si usano le due parentesi;
            m.AddDisplay(d2.Update);

            m.Start();
        }