Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace mw61
- {
- class Program
- {
- static void Main(string[] args)
- {
- //var anonim = 1;
- //anonim = new { Name = "Dynamiczny", Value = 10 };
- object obiekt = 1;
- dynamic dyn = 1;
- //dyn = new { Name = "Dynamiczny", Value = 10 };
- dyn = null;
- //dyn.TreleMorele();
- //System.Console.WriteLine("{0} - {1}",dyn.Name, dyn.Value);
- //System.Console.WriteLine("{0} - {1}", anonim.Name, anonim.Value);
- //MyDel Del = new MyDel(WriteToConsol);
- //Del += WriteToFile;
- //Del("aaaaa");
- //Info(Del);
- Info(delegate(string x) {
- Console.WriteLine("pierwsze wywołanie za pomoca anonimowego delegata");
- });
- Info((string x)=>
- Console.WriteLine("drugie wywołanie za pomoca wyrażenia lambda")
- );
- System.Console.ReadKey();
- }
- public delegate void MyDel(string text);
- private static void WriteToConsol(string text)
- {
- System.Console.WriteLine(text);
- }
- private static void WriteToFile(string text)
- {
- System.Console.WriteLine("zapis do pliku: " + text);
- }
- public static void Info(MyDel del)
- {
- del("Info about:");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement