use MOONLIGHT symbol
[mono.git] / mcs / class / System / System.ComponentModel / DataObjectAttribute.cs
1 //\r
2 // (C) 2006 Mainsoft Corporation (http://www.mainsoft.com)\r
3 //\r
4 // Authors:\r
5 //      Konstantin Triger <kostat@mainsoft.com>\r
6 //\r
7 // Permission is hereby granted, free of charge, to any person obtaining\r
8 // a copy of this software and associated documentation files (the\r
9 // "Software"), to deal in the Software without restriction, including\r
10 // without limitation the rights to use, copy, modify, merge, publish,\r
11 // distribute, sublicense, and/or sell copies of the Software, and to\r
12 // permit persons to whom the Software is furnished to do so, subject to\r
13 // the following conditions:\r
14 //\r
15 // The above copyright notice and this permission notice shall be\r
16 // included in all copies or substantial portions of the Software.\r
17 //\r
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
19 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
20 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
21 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
22 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
23 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
24 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
25 //\r
26 \r
27 #if NET_2_0\r
28 \r
29 using System;\r
30 using System.Collections.Generic;\r
31 using System.Text;\r
32 \r
33 namespace System.ComponentModel\r
34 {\r
35         [AttributeUsageAttribute (AttributeTargets.Class)]\r
36         public sealed class DataObjectAttribute : Attribute\r
37         {\r
38                 #region Fields\r
39 \r
40                 public static readonly DataObjectAttribute DataObject;\r
41                 public static readonly DataObjectAttribute Default;\r
42                 public static readonly DataObjectAttribute NonDataObject;\r
43 \r
44                 readonly bool _isDataObject;\r
45 \r
46                 #endregion\r
47 \r
48                 #region Constructors\r
49 \r
50                 static DataObjectAttribute () {\r
51                         DataObject = new DataObjectAttribute (true);\r
52                         NonDataObject = new DataObjectAttribute (false);\r
53                         Default = NonDataObject;\r
54                 }\r
55 \r
56                 public DataObjectAttribute () : this (true) { }\r
57                 public DataObjectAttribute (bool isDataObject) {\r
58                         _isDataObject = isDataObject;\r
59                 }\r
60 \r
61                 #endregion\r
62 \r
63                 #region Properties\r
64 \r
65                 public bool IsDataObject { get { return _isDataObject; } }\r
66 \r
67                 #endregion\r
68 \r
69                 #region Methods\r
70 \r
71                 public override bool Equals (object obj) {\r
72                         if (!(obj is DataObjectAttribute))\r
73                                 return false;\r
74 \r
75                         return ((DataObjectAttribute) obj).IsDataObject == IsDataObject;\r
76                 }\r
77                 public override int GetHashCode () {\r
78                         return IsDataObject.GetHashCode ();\r
79                 }\r
80                 public override bool IsDefaultAttribute () {\r
81                         return Default.Equals (this);\r
82                 }\r
83 \r
84                 #endregion\r
85         }\r
86 }\r
87 \r
88 #endif