[mcs] Validate more nameof argument expressions
[mono.git] / mcs / class / System.ComponentModel.Composition / src / ComponentModel / SilverlightAdditions.cs
1 // -----------------------------------------------------------------------\r
2 // Copyright (c) Microsoft Corporation.  All rights reserved.\r
3 // -----------------------------------------------------------------------\r
4 using System;\r
5 using System.Collections;\r
6 using System.Collections.Generic;\r
7 using System.Diagnostics;\r
8 using System.Diagnostics.CodeAnalysis;\r
9 \r
10 namespace System\r
11 {\r
12     [Conditional("NOT_SILVERLIGHT")]    // Trick so that the attribute is never actually applied\r
13     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Delegate, Inherited = false)]\r
14     internal sealed class SerializableAttribute : Attribute\r
15     {\r
16     }\r
17 }\r
18 \r
19 namespace System.ComponentModel\r
20 {\r
21     internal sealed class LocalizableAttribute : Attribute\r
22     {\r
23         [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "isLocalizable")]\r
24         public LocalizableAttribute(bool isLocalizable)\r
25         {\r
26         }\r
27     }\r
28 }\r
29 \r
30 #if !CLR40\r
31 namespace System.Collections.Generic\r
32 {\r
33     internal class HashSet<T> : IEnumerable<T>\r
34     {\r
35         private Dictionary<T, object> _set = new Dictionary<T, object>();\r
36 \r
37         public HashSet()\r
38         {\r
39         }\r
40 \r
41         public HashSet(IEnumerable<T> items)\r
42         {\r
43             foreach (T item in items)\r
44             {\r
45                 Add(item);\r
46             }\r
47         }\r
48 \r
49         public bool Add(T item)\r
50         {\r
51             if (!this._set.ContainsKey(item))\r
52             {\r
53                 this._set.Add(item, null);\r
54                 return true;\r
55             }\r
56             return false;\r
57         }\r
58 \r
59         public void Clear()\r
60         {\r
61             this._set.Clear();\r
62         }\r
63 \r
64         public bool Contains(T item)\r
65         {\r
66             return this._set.ContainsKey(item);\r
67         }\r
68 \r
69         public bool Remove(T item)\r
70         {\r
71             if (this._set.ContainsKey(item))\r
72             {\r
73                 this._set.Remove(item);\r
74                 return true;\r
75             }\r
76             return false;\r
77         }\r
78 \r
79         public IEnumerator<T> GetEnumerator()\r
80         {\r
81             return this._set.Keys.GetEnumerator();\r
82         }\r
83 \r
84         IEnumerator IEnumerable.GetEnumerator()\r
85         {\r
86             return GetEnumerator();\r
87         }\r
88     }\r
89 }\r
90 #endif\r