2 using System.Reflection;
4 [assembly: AssemblyTitle ("Foo")]
5 [assembly: AssemblyVersion ("1.0.2")]
9 [AttributeUsage (AttributeTargets.All)]
10 public class MineAttribute : Attribute {
14 public MineAttribute (string s)
30 [return: Mine ("Bar")]
31 public static int Main ()
33 Type t = typeof (Foo);
34 foreach (MemberInfo m in t.GetMembers ()){
35 if (m.Name == "Main"){
36 MethodInfo mb = (MethodInfo) m;
38 ICustomAttributeProvider p = mb.ReturnTypeCustomAttributes;
39 object [] ret_attrs = p.GetCustomAttributes (false);
41 if (ret_attrs.Length != 1){
42 Console.WriteLine ("Got more than one return attribute");
45 if (!(ret_attrs [0] is MineAttribute)){
46 Console.WriteLine ("Dit not get a MineAttribute");
50 MineAttribute ma = (MineAttribute) ret_attrs [0];
51 if (ma.name != "Bar"){
52 Console.WriteLine ("The return attribute is not Bar");