Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 12, 2015 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/84b69da14dff59521d1a to your computer and use it in GitHub Desktop.
Save Fhernd/84b69da14dff59521d1a to your computer and use it in GitHub Desktop.
Uso de atributo `Absolete` en C#.
// 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