[runtime] Overwrite stacktrace for exception on re-throw. Fixes #1856.
[mono.git] / mcs / class / System.ServiceModel.Web / System.ServiceModel.Syndication / SyndicationElementExtensionCollection.cs
1 //
2 // SyndicationElementExtensionCollection.cs
3 //
4 // Author:
5 //      Atsushi Enomoto  <atsushi@ximian.com>
6 //
7 // Copyright (C) 2007 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 using System;
29 using System.Collections.Generic;
30 using System.Collections.ObjectModel;
31 using System.IO;
32 using System.Runtime.Serialization;
33 using System.Text;
34 using System.Xml;
35 using System.Xml.Serialization;
36
37 namespace System.ServiceModel.Syndication
38 {
39         public sealed class SyndicationElementExtensionCollection : Collection<SyndicationElementExtension>
40         {
41                 internal SyndicationElementExtensionCollection ()
42                 {
43                 }
44
45                 internal SyndicationElementExtensionCollection (IEnumerable<SyndicationElementExtension> source)
46                 {
47                         if (source == null)
48                                 throw new ArgumentNullException ("source");
49                         foreach (SyndicationElementExtension item in source)
50                                 Add (item);
51                 }
52
53                 public void Add (object extension)
54                 {
55                         Add (new SyndicationElementExtension (extension));
56                 }
57
58                 public void Add (object dataContractExtension, DataContractSerializer serializer)
59                 {
60                         Add (new SyndicationElementExtension (dataContractExtension, serializer));
61                 }
62
63                 public void Add (object xmlSerializerExtension, XmlSerializer serializer)
64                 {
65                         Add (new SyndicationElementExtension (xmlSerializerExtension, serializer));
66                 }
67
68                 public void Add (string outerName, string outerNamespace, object dataContractExtension)
69                 {
70                         Add (new SyndicationElementExtension (outerName, outerNamespace, dataContractExtension));
71                 }
72
73                 public void Add (string outerName, string outerNamespace, object dataContractExtension, XmlObjectSerializer dataContractSerializer)
74                 {
75                         Add (new SyndicationElementExtension (outerName, outerNamespace, dataContractExtension, dataContractSerializer));
76                 }
77
78                 public void Add (XmlReader xmlReader)
79                 {
80                         Add (new SyndicationElementExtension (xmlReader));
81                 }
82
83                 new void Add (SyndicationElementExtension item)
84                 {
85                         base.Add (item);
86                 }
87
88                 [MonoTODO ("Find out what is expected here")]
89                 protected override void ClearItems ()
90                 {
91                         base.ClearItems ();
92                 }
93
94                 [MonoTODO]
95                 public XmlReader GetReaderAtElementExtensions ()
96                 {
97                         throw new NotImplementedException ();
98                 }
99
100                 protected override void InsertItem (int index, SyndicationElementExtension item)
101                 {
102                         if (item == null)
103                                 throw new ArgumentNullException ("item");
104                         base.InsertItem (index, item);
105                 }
106
107                 public Collection<TExtension> ReadElementExtensions<TExtension> (string extensionName, string extensionNamespace)
108                 {
109                         Collection<TExtension> c = new Collection<TExtension> ();
110                         foreach (SyndicationElementExtension e in this)
111                                 if (e.OuterName == extensionName && e.OuterNamespace == extensionNamespace)
112                                         c.Add (e.GetObject<TExtension> ());
113                         return c;
114                 }
115
116                 public Collection<TExtension> ReadElementExtensions<TExtension> (string extensionName, string extensionNamespace, XmlObjectSerializer serializer)
117                 {
118                         if (serializer == null)
119                                 throw new ArgumentNullException ("serializer");
120
121                         Collection<TExtension> c = new Collection<TExtension> ();
122                         foreach (SyndicationElementExtension e in this)
123                                 if (e.OuterName == extensionName && e.OuterNamespace == extensionNamespace)
124                                         c.Add (e.GetObject<TExtension> (serializer));
125                         return c;
126                 }
127
128                 public Collection<TExtension> ReadElementExtensions<TExtension> (string extensionName, string extensionNamespace, XmlSerializer serializer)
129                 {
130                         if (serializer == null)
131                                 throw new ArgumentNullException ("serializer");
132
133                         Collection<TExtension> c = new Collection<TExtension> ();
134                         foreach (SyndicationElementExtension e in this)
135                                 if (e.OuterName == extensionName && e.OuterNamespace == extensionNamespace)
136                                         c.Add (e.GetObject<TExtension> (serializer));
137                         return c;
138                 }
139
140                 [MonoTODO ("Find out what is expected here")]
141                 protected override void RemoveItem (int index)
142                 {
143                         base.RemoveItem (index);
144                 }
145
146                 protected override void SetItem (int index, SyndicationElementExtension item)
147                 {
148                         if (item == null)
149                                 throw new ArgumentNullException ("item");
150                         base.SetItem (index, item);
151                 }
152         }
153 }