Advertisement
Fhernd

CompatibilidadDelegados.cs

Jul 26th, 2014
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Articulos.Cap04
  4. {
  5.     public delegate void Delegado1();
  6.     public delegate void Delegado2();
  7.    
  8.     public class Aplicacion
  9.     {
  10.         public static void Main()
  11.         {
  12.             Delegado1 d1 = Metodo;
  13.             // Generará el error CS0029:
  14.             // Cannot implicitly convert type...:
  15.             Delegado2 d2 = d1;
  16.         }
  17.        
  18.         public static void Metodo()
  19.         {
  20.             Console.WriteLine("Metodo");
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement