/// <summary> /// Initializes a new instance of the <see cref="PostItAttribute"/> class. /// </summary> /// <param name="message">The message to attach to the tagged object.</param> /// <param name="author">An <see cref="AuthorAttribute"/> class representing the author of the message</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> or <paramref name="author"/> /// is null</exception> /// <exception cref="ArgumentException">Thrown if <paramref name="author"/> is not derived from <see cref="AuthorAttribute"/></exception> public PostItAttribute(string message, Type author) { if (message == null) throw new ArgumentNullException("message"); if (author == null) throw new ArgumentNullException("author"); if (!typeof(AuthorAttribute).IsAssignableFrom(author.GetType())) throw new ArgumentException("author must derive from AuthorAttribute"); this.message = message; ConstructorInfo ci = TypeHelper.GetConstructor(author, Type.EmptyTypes); this.author = (AuthorAttribute)ci.Invoke(null); }
/// <summary> /// Initializes a new instance of the <see cref="PostItAttribute"/> class. /// </summary> /// <param name="message">The message to attach to the tagged object.</param> /// <param name="author">An <see cref="AuthorAttribute"/> class representing the author of the message</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> or <paramref name="author"/> /// is null</exception> /// <exception cref="ArgumentException">Thrown if <paramref name="author"/> is not derived from <see cref="AuthorAttribute"/></exception> public PostItAttribute(string message, Type author) { if (message == null) { throw new ArgumentNullException("message"); } if (author == null) { throw new ArgumentNullException("author"); } if (!typeof(AuthorAttribute).IsAssignableFrom(author.GetType())) { throw new ArgumentException("author must derive from AuthorAttribute"); } this.message = message; ConstructorInfo ci = TypeHelper.GetConstructor(author, Type.EmptyTypes); this.author = (AuthorAttribute)ci.Invoke(null); }