Created
July 12, 2015 13:10
-
-
Save Fhernd/84b69da14dff59521d1a to your computer and use it in GitHub Desktop.
Uso de atributo `Absolete` en C#.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OrtizOL - xCSw - http://ortizol.blogspot.com | |
using System; | |
public class Email | |
{ | |
[ObsoleteAttribute] | |
public bool ComprobarEmail() | |
{ | |
// Implementacion versión 1. | |
return false; | |
} | |
public bool ValidarEmail() | |
{ | |
// Implementación versiones 2, y 3. | |
return false; | |
} | |
} | |
public class EmailTest | |
{ | |
public static void Main() | |
{ | |
Console.WriteLine(Environment.NewLine); | |
Email email = new Email(); | |
email.ComprobarEmail(); // Se genera advertencia en tiempo de compilación: CS0612 | |
email.ValidarEmail(); // No genera ninguna advertencia o error en tiempo de compilación. | |
Console.WriteLine(Environment.NewLine); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment