March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System; using System.Reflection; namespace Samples { [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)] public class AuthorAttribute: Attribute { private string familyName; private string givenName; public AuthorAttribute(string familyName) { this.familyName = familyName; } public override String ToString() { return String.Format("Author: {0} {1}", familyName, givenName); } public string FamilyName { get {return familyName;} } public string GivenName { get {return givenName;} set {givenName = value;} } } [Author("Watkins", GivenName = "Damien")] [Author("Abrams")] public class AttributeSample { [Author("Abrams", GivenName = "Brad")] public static void Main() { Type t = typeof(AttributeSample); Attribute[] ...Read now
Unlock full access