1 'Author: Ritvik Mayank <mritvik@novell.com>
2 'Copyright (C) 2005 Novell Inc. (http://www.novell.com)
3 ' multiple-use for derived takes both the attributes
7 <AttributeUsage(AttributeTargets.Class, AllowMultiple := True, _
9 Class MultiUseAttribute
10 Inherits System.Attribute
11 Public Sub New(ByVal Value As Boolean)
15 <AttributeUsage(AttributeTargets.Class, Inherited := True)> _
16 Class SingleUseAttribute
18 Public Sub New(ByVal Value As Boolean)
22 <SingleUse(True), MultiUse(True)> Class Base
25 <SingleUse(False), MultiUse(False)> _
32 Dim type As Type = GetType(Derived)
33 Dim arr() As Object = _
34 type.GetCustomAttributes(GetType(Attribute), True)
35 If arr.Length <> 3 Then
36 Throw New Exception ("multiple-use attribute is inherited on a derived type can take both attributes. expected total attributes = 3 but got " & arr.Length)