Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created June 7, 2014 02:47
Show Gist options
  • Save Fhernd/a31b24240fa694e6aaa8 to your computer and use it in GitHub Desktop.
Save Fhernd/a31b24240fa694e6aaa8 to your computer and use it in GitHub Desktop.
Creación de un atributo para marcar la autoría y la versión de un elemento de programa en C#.
using System;
namespace Recetas.Cap03
{
[System.AttributeUsage( System.AttributeTargets.Class |
System.AttributeTargets.Struct)
]
public class AutorAttribute : Attribute
{
private string nombre;
public double version;
public AutorAttribute(string nombre)
{
this.nombre = nombre;
version = 1.0;
}
}
[Autor("John Ortiz", version = 1.1)]
public class ClaseEjemplo
{
// Implementación
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment