Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,74 @@
//
// CollectionDebuggerView.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Diagnostics;
namespace System.Collections.Generic
{
//
// Custom debugger type proxy to display collections as arrays
//
internal sealed class CollectionDebuggerView<T>
{
readonly ICollection<T> c;
public CollectionDebuggerView (ICollection<T> col)
{
this.c = col;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public T[] Items {
get {
var o = new T [c.Count];
c.CopyTo (o, 0);
return o;
}
}
}
internal sealed class CollectionDebuggerView<T, U>
{
readonly ICollection<KeyValuePair<T, U>> c;
public CollectionDebuggerView (ICollection<KeyValuePair<T, U>> col)
{
this.c = col;
}
[DebuggerBrowsable (DebuggerBrowsableState.RootHidden)]
public KeyValuePair<T, U>[] Items {
get {
var o = new KeyValuePair<T, U> [c.Count];
c.CopyTo (o, 0);
return o;
}
}
}
}

View File

@@ -0,0 +1,130 @@
//
// Comparer.cs
//
// Authors:
// Ben Maurer (bmaurer@ximian.com)
// Marek Safar (marek.safar@gmail.com)
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic {
[Serializable]
public abstract class Comparer<T> : IComparer<T>, IComparer
{
static readonly Comparer <T> _default = typeof (IComparable<T>).IsAssignableFrom (typeof (T)) ?
(Comparer<T>) Activator.CreateInstance (typeof (GenericComparer <>).MakeGenericType (typeof (T))) :
new DefaultComparer ();
public abstract int Compare (T x, T y);
public static Comparer<T> Default {
get {
return _default;
}
}
#if NET_4_5
public static Comparer<T> Create (Comparison<T> comparison)
{
if (comparison == null)
throw new ArgumentNullException ("comparison");
return new ComparisonComparer<T> (comparison);
}
#endif
int IComparer.Compare (object x, object y)
{
if (x == y)
return 0;
if (x == null)
return y == null ? 0 : -1;
if (y == null)
return 1;
if (x is T && y is T)
return Compare ((T) x, (T) y);
throw new ArgumentException ();
}
[Serializable]
sealed class DefaultComparer : Comparer<T>
{
public override int Compare (T x, T y)
{
// `null' is less than any other ref type
if (x == null)
return y == null ? 0 : -1;
if (y == null)
return 1;
var i = x as IComparable;
if (i != null)
return i.CompareTo (y);
i = y as IComparable;
if (i != null)
return -i.CompareTo (x);
throw new ArgumentException ("At least one argument has to implement IComparable interface");
}
}
}
[Serializable]
sealed class GenericComparer<T> : Comparer<T> where T : IComparable<T>
{
public override int Compare (T x, T y)
{
// `null' is less than any other ref type
if (x == null)
return y == null ? 0 : -1;
if (y == null)
return 1;
return x.CompareTo (y);
}
}
#if NET_4_5
[Serializable]
sealed class ComparisonComparer<T> : Comparer<T>
{
readonly Comparison<T> comparison;
public ComparisonComparer (Comparison<T> comparison)
{
this.comparison = comparison;
}
public override int Compare (T x, T y)
{
return comparison (x, y);
}
}
#endif
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,229 @@
//
// EqualityComparer.cs
//
// Authors:
// Ben Maurer (bmaurer@ximian.com)
// Marek Safar (marek.safar@gmail.com)
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic {
[Serializable]
public abstract class EqualityComparer <T> : IEqualityComparer, IEqualityComparer <T> {
static EqualityComparer ()
{
var t = typeof (T);
if (t == typeof (string)) {
_default = (EqualityComparer<T>) (object) new InternalStringComparer ();
return;
}
if (t == typeof (int)) {
_default = (EqualityComparer<T>) (object) new IntEqualityComparer ();
return;
}
if (t.IsEnum && Enum.GetUnderlyingType (t) == typeof (int)) {
_default = new EnumIntEqualityComparer<T> ();
return;
}
if (typeof (IEquatable <T>).IsAssignableFrom (t))
_default = (EqualityComparer <T>) Activator.CreateInstance (typeof (GenericEqualityComparer <>).MakeGenericType (t));
else
_default = new DefaultComparer<T> ();
}
public abstract int GetHashCode (T obj);
public abstract bool Equals (T x, T y);
static readonly EqualityComparer <T> _default;
public static EqualityComparer <T> Default {
get {
return _default;
}
}
int IEqualityComparer.GetHashCode (object obj)
{
if (obj == null)
return 0;
if (!(obj is T))
throw new ArgumentException ("Argument is not compatible", "obj");
return GetHashCode ((T)obj);
}
bool IEqualityComparer.Equals (object x, object y)
{
if (x == y)
return true;
if (x == null || y == null)
return false;
if (!(x is T))
throw new ArgumentException ("Argument is not compatible", "x");
if (!(y is T))
throw new ArgumentException ("Argument is not compatible", "y");
return Equals ((T)x, (T)y);
}
internal virtual int IndexOf (T[] array, T value, int startIndex, int endIndex)
{
for (int i = startIndex; i < endIndex; ++i) {
if (Equals (Array.UnsafeLoad (array, i), value))
return i;
}
return -1;
}
}
[Serializable]
sealed class DefaultComparer<T> : EqualityComparer<T> {
public override int GetHashCode (T obj)
{
if (obj == null)
return 0;
return obj.GetHashCode ();
}
public override bool Equals (T x, T y)
{
if (x == null)
return y == null;
return x.Equals (y);
}
}
[Serializable]
sealed class InternalStringComparer : EqualityComparer<string> {
public override int GetHashCode (string obj)
{
if (obj == null)
return 0;
return obj.GetHashCode ();
}
public override bool Equals (string x, string y)
{
if (x == null)
return y == null;
if ((object) x == (object) y)
return true;
return x.Equals (y);
}
internal override int IndexOf (string[] array, string value, int startIndex, int endIndex)
{
for (int i = startIndex; i < endIndex; ++i) {
if (Array.UnsafeLoad (array, i) == value)
return i;
}
return -1;
}
}
[Serializable]
sealed class IntEqualityComparer : EqualityComparer<int>
{
public override int GetHashCode (int obj)
{
return obj;
}
public override bool Equals (int x, int y)
{
return x == y;
}
internal override int IndexOf (int[] array, int value, int startIndex, int endIndex)
{
for (int i = startIndex; i < endIndex; ++i) {
if (Array.UnsafeLoad (array, i) == value)
return i;
}
return -1;
}
}
[Serializable]
sealed class EnumIntEqualityComparer<T> : EqualityComparer<T>
{
public override int GetHashCode (T obj)
{
return Array.UnsafeMov<T, int> (obj);
}
public override bool Equals (T x, T y)
{
return Array.UnsafeMov<T, int> (x) == Array.UnsafeMov<T, int> (y);
}
internal override int IndexOf (T[] array, T value, int startIndex, int endIndex)
{
int v = Array.UnsafeMov<T, int> (value);
var a = Array.UnsafeMov<T[], int[]> (array);
for (int i = startIndex; i < endIndex; ++i) {
if (Array.UnsafeLoad (a, i) == v)
return i;
}
return -1;
}
}
[Serializable]
sealed class GenericEqualityComparer <T> : EqualityComparer <T> where T : IEquatable <T> {
public override int GetHashCode (T obj)
{
if (obj == null)
return 0;
return obj.GetHashCode ();
}
public override bool Equals (T x, T y)
{
if (x == null)
return y == null;
return x.Equals (y);
}
}
}

View File

@@ -0,0 +1,59 @@
// -*- Mode: csharp; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Collections.Generic.ICollection
//
// Author:
// Martin Baulig (martin@ximian.com)
//
// (C) 2003 Novell, Inc.
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
public interface ICollection<T> : IEnumerable<T>
{
int Count {
get;
}
bool IsReadOnly {
get;
}
void Add (T item);
void Clear ();
bool Contains (T item);
void CopyTo (T[] array, int arrayIndex);
bool Remove (T item);
}
}

View File

@@ -0,0 +1,47 @@
//
// System.Collections.Generic.IComparer
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
// Marek Safar (marek.safar@gmail.com)
//
// (C) 2003 Ben Maurer
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
#if NET_4_0
public interface IComparer<in T>
#else
public interface IComparer<T>
#endif
{
int Compare (T x, T y);
}
}

View File

@@ -0,0 +1,49 @@
//
// System.Collections.Generic.IDictionary
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
//
// (C) 2003 Ben Maurer
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
public interface IDictionary<TKey,TValue> : ICollection<KeyValuePair<TKey,TValue>>
{
void Add (TKey key, TValue value);
bool ContainsKey (TKey key);
bool Remove (TKey key);
bool TryGetValue (TKey key, out TValue value);
TValue this[TKey key] { get; set; }
ICollection<TKey> Keys { get; }
ICollection<TValue> Values { get; }
}
}

View File

@@ -0,0 +1,48 @@
// -*- Mode: csharp; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Collections.Generic.IEnumerable
//
// Author:
// Martin Baulig (martin@ximian.com)
// Marek Safar (marek.safar@gmail.com)
//
// (C) 2003 Novell, Inc.
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
#if NET_4_0
public interface IEnumerable<out T> : IEnumerable
#else
public interface IEnumerable<T> : IEnumerable
#endif
{
new IEnumerator<T> GetEnumerator ();
}
}

View File

@@ -0,0 +1,50 @@
// -*- Mode: csharp; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Collections.Generic.IEnumerator
//
// Author:
// Martin Baulig (martin@ximian.com)
// Marek Safar (marek.safar@gmail.com)
//
// (C) 2003 Novell, Inc.
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
#if NET_4_0
public interface IEnumerator<out T> : IDisposable, IEnumerator
#else
public interface IEnumerator<T> : IDisposable, IEnumerator
#endif
{
new T Current {
get;
}
}
}

View File

@@ -0,0 +1,48 @@
//
// System.Collections.Generic.IEqualityComparer
//
// Authors:
// Ben Maurer (bmaurer@novell.com)
// Marek Safar (marek.safar@gmail.com)
//
// (C) 2005 Ben Maurer
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
#if NET_4_0
public interface IEqualityComparer<in T>
#else
public interface IEqualityComparer<T>
#endif
{
bool Equals (T x, T y);
int GetHashCode (T obj);
}
}

View File

@@ -0,0 +1,51 @@
// -*- Mode: csharp; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
//
// System.Collections.Generic.IList
//
// Author:
// Martin Baulig (martin@ximian.com)
//
// (C) 2003 Novell, Inc.
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.InteropServices;
namespace System.Collections.Generic
{
public interface IList<T> : ICollection<T>
{
int IndexOf (T item);
void Insert (int index, T item);
void RemoveAt (int index);
T this [int index] {
get; set;
}
}
}

View File

@@ -0,0 +1,39 @@
//
// IReadOnlyCollection.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2012 Xamarin, Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
namespace System.Collections.Generic
{
public interface IReadOnlyCollection<out T> : IEnumerable<T>
{
int Count { get; }
}
}
#endif

View File

@@ -0,0 +1,44 @@
//
// IReadOnlyDictionary.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2011 Xamarin, Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
namespace System.Collections.Generic
{
public interface IReadOnlyDictionary<TKey, TValue> : IReadOnlyCollection<KeyValuePair<TKey, TValue>>
{
TValue this [TKey key] { get; }
IEnumerable<TKey> Keys { get; }
IEnumerable<TValue> Values { get; }
bool ContainsKey (TKey key);
bool TryGetValue (TKey key, out TValue value);
}
}
#endif

View File

@@ -0,0 +1,39 @@
//
// IReadOnlyList.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2011 Xamarin, Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
namespace System.Collections.Generic
{
public interface IReadOnlyList<out T> : IReadOnlyCollection<T>
{
T this [int index] { get; }
}
}
#endif

View File

@@ -0,0 +1,49 @@
//
// System.Collections.Generic.KeyNotFoundException.cs
//
// Author:
// Duncan Mak (duncan@ximian.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Collections.Generic {
[ComVisible(true)]
[Serializable]
public class KeyNotFoundException : SystemException, ISerializable {
public KeyNotFoundException ()
: base ("The given key was not present in the dictionary.") {}
public KeyNotFoundException (string message)
: base (message) {}
public KeyNotFoundException (string message, Exception innerException)
: base (message, innerException) {}
protected KeyNotFoundException (SerializationInfo info, StreamingContext context)
: base (info, context) {}
}
}

View File

@@ -0,0 +1,63 @@
//
// System.Collections.Generic.KeyValuePair
//
// Authors:
// Ben Maurer (bmaurer@users.sourceforge.net)
//
// (C) 2003 Ben Maurer
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Diagnostics;
namespace System.Collections.Generic {
[Serializable]
public struct KeyValuePair<TKey,TValue> {
private TKey key;
private TValue value;
public TKey Key {
get { return key; }
private set { key = value; }
}
public TValue Value {
get { return value; }
private set { this.value = value; }
}
public KeyValuePair (TKey key, TValue value)
{
this.key = key;
this.value = value;
}
public override string ToString()
{
return "[" + (Key != null ? Key.ToString() : string.Empty) + ", " + (Value != null ? Value.ToString() : string.Empty) + "]";
}
}
}

File diff suppressed because it is too large Load Diff