Fixing an issue with output parameters that are of type IntPtr
[castle.git] / Core / Castle.Core / SilverlightExtensions.cs
blob32b0fdaca9e5d9e9ed9b0b427968b43e2c72891d
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 #if SILVERLIGHT
17 namespace System
19 using System.Collections.Generic;
21 public static class SilverlightExtensions
23 public static T[] FindAll<T>(this T[] array, Predicate<T> match)
25 if (array == null)
27 throw new ArgumentNullException("array");
29 if (match == null)
31 throw new ArgumentNullException("match");
33 List<T> list = new List<T>();
34 for (int i = 0; i < array.Length; i++)
36 if (match(array[i]))
38 list.Add(array[i]);
41 return list.ToArray();
46 namespace System.Collections.Specialized
48 using Generic;
50 public class NameValueCollection : Dictionary<string, string>
52 public NameValueCollection() : base(StringComparer.InvariantCultureIgnoreCase)
56 public new string this[string key]
58 get
60 string result;
61 TryGetValue(key, out result);
62 return result;
64 set
66 base[key] = value;
72 namespace System.Collections
74 using Generic;
76 public class CollectionBase : List<object>
78 protected CollectionBase InnerList
80 get { return this; }
84 public class ReadOnlyCollectionBase : List<object>
86 protected ReadOnlyCollectionBase InnerList
88 get { return this; }
93 namespace System.Threading
95 public class ReaderWriterLock
97 private object _syncObject = new object();
99 public ReaderWriterLock()
103 public void AcquireWriterLock(int timeout)
105 Monitor.Enter(_syncObject);
108 public void AcquireReaderLock(int timeout)
110 Monitor.Enter(_syncObject);
113 public void ReleaseWriterLock()
115 Monitor.Exit(_syncObject);
118 public void ReleaseLock()
120 Monitor.Exit(_syncObject);
125 namespace System.Configuration
127 public class ConfigurationErrorsException : Exception
129 public ConfigurationErrorsException(string message) : base(message)
133 public ConfigurationErrorsException(string message, Exception inner) : base(message, inner)
139 namespace System.ComponentModel
141 public interface ISupportInitialize
143 void BeginInit();
144 void EndInit();
148 #endif