~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to contrib/ICSharpCode.Decompiler/Tests/CustomAttributes/S_CustomAttributes.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
 
 
6
namespace aa
 
7
{
 
8
        public static class CustomAttributes
 
9
        {
 
10
                [Flags]
 
11
                public enum EnumWithFlag
 
12
                {
 
13
                        All = 15,
 
14
                        None = 0,
 
15
                        Item1 = 1,
 
16
                        Item2 = 2,
 
17
                        Item3 = 4,
 
18
                        Item4 = 8
 
19
                }
 
20
                [AttributeUsage(AttributeTargets.All)]
 
21
                public class MyAttribute : Attribute
 
22
                {
 
23
                        public MyAttribute(object val)
 
24
                        {
 
25
                        }
 
26
                }
 
27
                [CustomAttributes.MyAttribute(CustomAttributes.EnumWithFlag.Item1 | CustomAttributes.EnumWithFlag.Item2)]
 
28
                private static int field;
 
29
                [CustomAttributes.MyAttribute(CustomAttributes.EnumWithFlag.All)]
 
30
                public static string Property
 
31
                {
 
32
                        get
 
33
                        {
 
34
                                return "aa";
 
35
                        }
 
36
                }
 
37
                [Obsolete("some message")]
 
38
                public static void ObsoletedMethod()
 
39
                {
 
40
                        //Console.WriteLine("{0} $$$ {1}", AttributeTargets.Interface, (AttributeTargets)(AttributeTargets.Property | AttributeTargets.Field));
 
41
                        Console.WriteLine("{0} $$$ {1}", AttributeTargets.Interface, AttributeTargets.Property | AttributeTargets.Field);
 
42
                        AttributeTargets attributeTargets = AttributeTargets.Property | AttributeTargets.Field;
 
43
                        Console.WriteLine("{0} $$$ {1}", AttributeTargets.Interface, attributeTargets);
 
44
                }
 
45
                // No Boxing
 
46
                [CustomAttributes.MyAttribute(new StringComparison[]
 
47
                {
 
48
                        StringComparison.Ordinal, 
 
49
                        StringComparison.CurrentCulture
 
50
                })]
 
51
                public static void ArrayAsAttribute1()
 
52
                {
 
53
                }
 
54
                // Boxing of each array element
 
55
                [CustomAttributes.MyAttribute(new object[]
 
56
                {
 
57
                        StringComparison.Ordinal, 
 
58
                        StringComparison.CurrentCulture
 
59
                })]
 
60
                public static void ArrayAsAttribute2()
 
61
                {
 
62
                }
 
63
        }
 
64
}
 
 
b'\\ No newline at end of file'