Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -0,0 +1,66 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22609.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Collections.Specialized.Tests", "tests\System.Collections.Specialized.Tests.csproj", "{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}"
ProjectSection(ProjectDependencies) = postProject
{63634289-90D7-4947-8BF3-DBBE98D76C85} = {63634289-90D7-4947-8BF3-DBBE98D76C85}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Collections.Specialized", "src\System.Collections.Specialized.csproj", "{63634289-90D7-4947-8BF3-DBBE98D76C85}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{9618597D-FDAE-42CB-B368-80DB80EA1E37}"
ProjectSection(SolutionItems) = preProject
..\.nuget\packages.Windows_NT.config = ..\.nuget\packages.Windows_NT.config
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{7F5F5134-00FE-4DE8-B20C-3DA8BA2EBA68}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.DebugNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<IsNETCoreApp>true</IsNETCoreApp>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp;
uap;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,248 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ------------------------------------------------------------------------------
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Collections.Specialized
{
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct BitVector32
{
public BitVector32(System.Collections.Specialized.BitVector32 value) { throw null; }
public BitVector32(int data) { throw null; }
public int Data { get { throw null; } }
public int this[System.Collections.Specialized.BitVector32.Section section] { get { throw null; } set { } }
public bool this[int bit] { get { throw null; } set { } }
public static int CreateMask() { throw null; }
public static int CreateMask(int previous) { throw null; }
public static System.Collections.Specialized.BitVector32.Section CreateSection(short maxValue) { throw null; }
public static System.Collections.Specialized.BitVector32.Section CreateSection(short maxValue, System.Collections.Specialized.BitVector32.Section previous) { throw null; }
public override bool Equals(object o) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
public static string ToString(System.Collections.Specialized.BitVector32 value) { throw null; }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct Section
{
public short Mask { get { throw null; } }
public short Offset { get { throw null; } }
public bool Equals(System.Collections.Specialized.BitVector32.Section obj) { throw null; }
public override bool Equals(object o) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Collections.Specialized.BitVector32.Section a, System.Collections.Specialized.BitVector32.Section b) { throw null; }
public static bool operator !=(System.Collections.Specialized.BitVector32.Section a, System.Collections.Specialized.BitVector32.Section b) { throw null; }
public override string ToString() { throw null; }
public static string ToString(System.Collections.Specialized.BitVector32.Section value) { throw null; }
}
}
public partial class HybridDictionary : System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable
{
public HybridDictionary() { }
public HybridDictionary(bool caseInsensitive) { }
public HybridDictionary(int initialSize) { }
public HybridDictionary(int initialSize, bool caseInsensitive) { }
public int Count { get { throw null; } }
public bool IsFixedSize { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public bool IsSynchronized { get { throw null; } }
public object this[object key] { get { throw null; } set { } }
public System.Collections.ICollection Keys { get { throw null; } }
public object SyncRoot { get { throw null; } }
public System.Collections.ICollection Values { get { throw null; } }
public void Add(object key, object value) { }
public void Clear() { }
public bool Contains(object key) { throw null; }
public void CopyTo(System.Array array, int index) { }
public System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
public void Remove(object key) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public partial interface IOrderedDictionary : System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable
{
object this[int index] { get; set; }
new System.Collections.IDictionaryEnumerator GetEnumerator();
void Insert(int index, object key, object value);
void RemoveAt(int index);
}
public partial class ListDictionary : System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable
{
public ListDictionary() { }
public ListDictionary(System.Collections.IComparer comparer) { }
public int Count { get { throw null; } }
public bool IsFixedSize { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public bool IsSynchronized { get { throw null; } }
public object this[object key] { get { throw null; } set { } }
public System.Collections.ICollection Keys { get { throw null; } }
public object SyncRoot { get { throw null; } }
public System.Collections.ICollection Values { get { throw null; } }
public void Add(object key, object value) { }
public void Clear() { }
public bool Contains(object key) { throw null; }
public void CopyTo(System.Array array, int index) { }
public System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
public void Remove(object key) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public abstract partial class NameObjectCollectionBase : System.Collections.ICollection, System.Collections.IEnumerable, System.Runtime.Serialization.ISerializable, System.Runtime.Serialization.IDeserializationCallback
{
protected NameObjectCollectionBase() { }
protected NameObjectCollectionBase(System.Collections.IEqualityComparer equalityComparer) { }
[System.ObsoleteAttribute("Please use NameObjectCollectionBase(IEqualityComparer) instead.")]
protected NameObjectCollectionBase(System.Collections.IHashCodeProvider hashProvider, System.Collections.IComparer comparer) { }
protected NameObjectCollectionBase(int capacity) { }
protected NameObjectCollectionBase(int capacity, System.Collections.IEqualityComparer equalityComparer) { }
[System.ObsoleteAttribute("Please use NameObjectCollectionBase(Int32, IEqualityComparer) instead.")]
protected NameObjectCollectionBase(int capacity, System.Collections.IHashCodeProvider hashProvider, System.Collections.IComparer comparer) { }
protected NameObjectCollectionBase(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public virtual int Count { get { throw null; } }
protected bool IsReadOnly { get { throw null; } set { } }
public virtual System.Collections.Specialized.NameObjectCollectionBase.KeysCollection Keys { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
protected void BaseAdd(string name, object value) { }
protected void BaseClear() { }
protected object BaseGet(int index) { throw null; }
protected object BaseGet(string name) { throw null; }
protected string[] BaseGetAllKeys() { throw null; }
protected object[] BaseGetAllValues() { throw null; }
protected object[] BaseGetAllValues(System.Type type) { throw null; }
protected string BaseGetKey(int index) { throw null; }
protected bool BaseHasKeys() { throw null; }
protected void BaseRemove(string name) { }
protected void BaseRemoveAt(int index) { }
protected void BaseSet(int index, object value) { }
protected void BaseSet(string name, object value) { }
public virtual System.Collections.IEnumerator GetEnumerator() { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public virtual void OnDeserialization(object sender) { }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
public partial class KeysCollection : System.Collections.ICollection, System.Collections.IEnumerable
{
internal KeysCollection() { }
public int Count { get { throw null; } }
public string this[int index] { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
public virtual string Get(int index) { throw null; }
public System.Collections.IEnumerator GetEnumerator() { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
}
}
public partial class NameValueCollection : System.Collections.Specialized.NameObjectCollectionBase
{
public NameValueCollection() { }
public NameValueCollection(System.Collections.IEqualityComparer equalityComparer) { }
[System.ObsoleteAttribute("Please use NameValueCollection(IEqualityComparer) instead.")]
public NameValueCollection(System.Collections.IHashCodeProvider hashProvider, System.Collections.IComparer comparer) { }
public NameValueCollection(System.Collections.Specialized.NameValueCollection col) { }
public NameValueCollection(int capacity) { }
public NameValueCollection(int capacity, System.Collections.IEqualityComparer equalityComparer) { }
[System.ObsoleteAttribute("Please use NameValueCollection(Int32, IEqualityComparer) instead.")]
public NameValueCollection(int capacity, System.Collections.IHashCodeProvider hashProvider, System.Collections.IComparer comparer) { }
public NameValueCollection(int capacity, System.Collections.Specialized.NameValueCollection col) { }
protected NameValueCollection(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public virtual string[] AllKeys { get { throw null; } }
public string this[int index] { get { throw null; } }
public string this[string name] { get { throw null; } set { } }
public void Add(System.Collections.Specialized.NameValueCollection c) { }
public virtual void Add(string name, string value) { }
public virtual void Clear() { }
public void CopyTo(System.Array dest, int index) { }
public virtual string Get(int index) { throw null; }
public virtual string Get(string name) { throw null; }
public virtual string GetKey(int index) { throw null; }
public virtual string[] GetValues(int index) { throw null; }
public virtual string[] GetValues(string name) { throw null; }
public bool HasKeys() { throw null; }
protected void InvalidateCachedArrays() { }
public virtual void Remove(string name) { }
public virtual void Set(string name, string value) { }
}
public partial class OrderedDictionary : System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable, System.Collections.Specialized.IOrderedDictionary, System.Runtime.Serialization.ISerializable, System.Runtime.Serialization.IDeserializationCallback
{
public OrderedDictionary() { }
public OrderedDictionary(System.Collections.IEqualityComparer comparer) { }
public OrderedDictionary(int capacity) { }
public OrderedDictionary(int capacity, System.Collections.IEqualityComparer comparer) { }
protected OrderedDictionary(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public int Count { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public object this[int index] { get { throw null; } set { } }
public object this[object key] { get { throw null; } set { } }
public System.Collections.ICollection Keys { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
bool System.Collections.IDictionary.IsFixedSize { get { throw null; } }
public System.Collections.ICollection Values { get { throw null; } }
public void Add(object key, object value) { }
public System.Collections.Specialized.OrderedDictionary AsReadOnly() { throw null; }
public void Clear() { }
public bool Contains(object key) { throw null; }
public void CopyTo(System.Array array, int index) { }
public virtual System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public void Insert(int index, object key, object value) { }
protected virtual void OnDeserialization(object sender) { }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { }
public void Remove(object key) { }
public void RemoveAt(int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public partial class StringCollection : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
{
public StringCollection() { }
public int Count { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public bool IsSynchronized { get { throw null; } }
public string this[int index] { get { throw null; } set { } }
public object SyncRoot { get { throw null; } }
bool System.Collections.IList.IsFixedSize { get { throw null; } }
bool System.Collections.IList.IsReadOnly { get { throw null; } }
object System.Collections.IList.this[int index] { get { throw null; } set { } }
public int Add(string value) { throw null; }
public void AddRange(string[] value) { }
public void Clear() { }
public bool Contains(string value) { throw null; }
public void CopyTo(string[] array, int index) { }
public System.Collections.Specialized.StringEnumerator GetEnumerator() { throw null; }
public int IndexOf(string value) { throw null; }
public void Insert(int index, string value) { }
public void Remove(string value) { }
public void RemoveAt(int index) { }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
int System.Collections.IList.Add(object value) { throw null; }
bool System.Collections.IList.Contains(object value) { throw null; }
int System.Collections.IList.IndexOf(object value) { throw null; }
void System.Collections.IList.Insert(int index, object value) { }
void System.Collections.IList.Remove(object value) { }
}
public partial class StringDictionary : System.Collections.IEnumerable
{
public StringDictionary() { }
public virtual int Count { get { throw null; } }
public virtual bool IsSynchronized { get { throw null; } }
public virtual string this[string key] { get { throw null; } set { } }
public virtual System.Collections.ICollection Keys { get { throw null; } }
public virtual object SyncRoot { get { throw null; } }
public virtual System.Collections.ICollection Values { get { throw null; } }
public virtual void Add(string key, string value) { }
public virtual void Clear() { }
public virtual bool ContainsKey(string key) { throw null; }
public virtual bool ContainsValue(string value) { throw null; }
public virtual void CopyTo(System.Array array, int index) { }
public virtual System.Collections.IEnumerator GetEnumerator() { throw null; }
public virtual void Remove(string key) { }
}
public partial class StringEnumerator
{
internal StringEnumerator() { }
public string Current { get { throw null; } }
public bool MoveNext() { throw null; }
public void Reset() { }
}
}

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System.Collections.Specialized.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" />
<ProjectReference Include="..\..\System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
net463-Windows_NT;
netcoreapp;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Argument_AddingDuplicate" xml:space="preserve">
<value>An item with the same key has already been added. Key: {0}</value>
</data>
<data name="Argument_InvalidValue" xml:space="preserve">
<value>Argument {0} should be larger than {1}.</value>
</data>
<data name="ArgumentOutOfRange_NeedNonNegNum" xml:space="preserve">
<value>Index is less than zero.</value>
</data>
<data name="InvalidOperation_EnumFailedVersion" xml:space="preserve">
<value>Collection was modified after the enumerator was instantiated.</value>
</data>
<data name="InvalidOperation_EnumOpCantHappen" xml:space="preserve">
<value>Enumerator is positioned before the first element or after the last element of the collection.</value>
</data>
<data name="Arg_MultiRank" xml:space="preserve">
<value>Multi dimension array is not supported on this operation.</value>
</data>
<data name="Arg_NonZeroLowerBound" xml:space="preserve">
<value>The lower bound of target array must be zero.</value>
</data>
<data name="Arg_InsufficientSpace" xml:space="preserve">
<value>Insufficient space in the target location to copy the information.</value>
</data>
<data name="CollectionReadOnly" xml:space="preserve">
<value>Collection is read-only.</value>
</data>
<data name="BitVectorFull" xml:space="preserve">
<value>Bit vector is full.</value>
</data>
<data name="OrderedDictionary_ReadOnly" xml:space="preserve">
<value>The OrderedDictionary is read-only and cannot be modified.</value>
</data>
<data name="Argument_ImplementIComparable" xml:space="preserve">
<value>At least one object must implement IComparable.</value>
</data>
<data name="OrderedDictionary_SerializationMismatch" xml:space="preserve">
<value>There was an error deserializing the OrderedDictionary. The ArrayList does not contain DictionaryEntries.</value>
</data>
<data name="Serialization_InvalidOnDeser" xml:space="preserve">
<value>OnDeserialization method was called while the object was not being deserialized.</value>
</data>
</root>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{63634289-90D7-4947-8BF3-DBBE98D76C85}</ProjectGuid>
<RootNamespace>System.Collections.Specialized</RootNamespace>
<AssemblyName>System.Collections.Specialized</AssemblyName>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net463'">true</IsPartialFacadeAssembly>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Release|AnyCPU'" />
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<Compile Include="System\Collections\Specialized\BitVector32.cs" />
<Compile Include="System\Collections\Specialized\HybridDictionary.cs" />
<Compile Include="System\Collections\Specialized\IOrderedDictionary.cs" />
<Compile Include="System\Collections\Specialized\ListDictionary.cs" />
<Compile Include="System\Collections\Specialized\NameObjectCollectionBase.cs" />
<Compile Include="System\Collections\Specialized\NameValueCollection.cs" />
<Compile Include="System\Collections\Specialized\OrderedDictionary.cs" />
<Compile Include="System\Collections\Specialized\StringCollection.cs" />
<Compile Include="System\Collections\Specialized\StringDictionary.cs" />
<Compile Include="$(CommonPath)\System\Collections\CompatibleComparer.cs">
<Link>Common\System\Collections\CompatibleComparer.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'net463'">
<TargetingPackReference Include="mscorlib" />
<TargetingPackReference Include="System" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Collections.NonGeneric" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.Tools" />
<Reference Include="System.Globalization.Extensions" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Threading" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,293 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using System.Text;
namespace System.Collections.Specialized
{
/// <devdoc>
/// <para>Provides a simple light bit vector with easy integer or Boolean access to
/// a 32 bit storage.</para>
/// </devdoc>
public struct BitVector32
{
private uint _data;
/// <devdoc>
/// <para>Initializes a new instance of the BitVector32 structure with the specified internal data.</para>
/// </devdoc>
public BitVector32(int data)
{
_data = (uint)data;
}
/// <devdoc>
/// <para>Initializes a new instance of the BitVector32 structure with the information in the specified
/// value.</para>
/// </devdoc>
public BitVector32(BitVector32 value)
{
_data = value._data;
}
/// <devdoc>
/// <para>Gets or sets a value indicating whether all the specified bits are set.</para>
/// </devdoc>
public bool this[int bit]
{
get
{
return (_data & bit) == (uint)bit;
}
set
{
if (value)
{
_data |= (uint)bit;
}
else
{
_data &= ~(uint)bit;
}
}
}
/// <devdoc>
/// <para>Gets or sets the value for the specified section.</para>
/// </devdoc>
public int this[Section section]
{
get
{
return (int)((_data & (uint)(section.Mask << section.Offset)) >> section.Offset);
}
set
{
// The code should really have originally validated "(value & section.Mask) == value" with
// an exception (it instead validated it with a Debug.Assert, which does little good in a
// public method when in a Release build). We don't include such a check now as it would
// likely break things and for little benefit.
value <<= section.Offset;
int offsetMask = (0xFFFF & (int)section.Mask) << section.Offset;
_data = (_data & ~(uint)offsetMask) | ((uint)value & (uint)offsetMask);
}
}
/// <devdoc>
/// returns the raw data stored in this bit vector...
/// </devdoc>
public int Data
{
get
{
return (int)_data;
}
}
private static short CountBitsSet(short mask)
{
// We assume that the bits are always right aligned, with no holes (i.e. always 00000111, never 00100011)
short value = 0;
while ((mask & 0x1) != 0)
{
value++;
mask >>= 1;
}
return value;
}
/// <devdoc>
/// <para> Creates the first mask in a series.</para>
/// </devdoc>
public static int CreateMask()
{
return CreateMask(0);
}
/// <devdoc>
/// Creates the next mask in a series.
/// </devdoc>
public static int CreateMask(int previous)
{
if (previous == 0)
{
return 1;
}
if (previous == unchecked((int)0x80000000))
{
throw new InvalidOperationException(SR.BitVectorFull);
}
return previous << 1;
}
/// <devdoc>
/// Given a highValue, creates the mask
/// </devdoc>
private static short CreateMaskFromHighValue(short highValue)
{
short required = 16;
while ((highValue & 0x8000) == 0)
{
required--;
highValue <<= 1;
}
ushort value = 0;
while (required > 0)
{
required--;
value <<= 1;
value |= 0x1;
}
return unchecked((short)value);
}
/// <devdoc>
/// <para>Creates the first section in a series, with the specified maximum value.</para>
/// </devdoc>
public static Section CreateSection(short maxValue)
{
return CreateSectionHelper(maxValue, 0, 0);
}
/// <devdoc>
/// <para>Creates the next section in a series, with the specified maximum value.</para>
/// </devdoc>
public static Section CreateSection(short maxValue, Section previous)
{
return CreateSectionHelper(maxValue, previous.Mask, previous.Offset);
}
private static Section CreateSectionHelper(short maxValue, short priorMask, short priorOffset)
{
if (maxValue < 1)
{
throw new ArgumentException(SR.Format(SR.Argument_InvalidValue, nameof(maxValue), 1), nameof(maxValue));
}
short offset = (short)(priorOffset + CountBitsSet(priorMask));
if (offset >= 32)
{
throw new InvalidOperationException(SR.BitVectorFull);
}
return new Section(CreateMaskFromHighValue(maxValue), offset);
}
public override bool Equals(object o)
{
if (!(o is BitVector32))
{
return false;
}
return _data == ((BitVector32)o)._data;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public static string ToString(BitVector32 value)
{
StringBuilder sb = new StringBuilder(/*"BitVector32{".Length*/12 + /*32 bits*/32 + /*"}".Length"*/1);
sb.Append("BitVector32{");
int locdata = (int)value._data;
for (int i = 0; i < 32; i++)
{
if ((locdata & 0x80000000) != 0)
{
sb.Append('1');
}
else
{
sb.Append('0');
}
locdata <<= 1;
}
sb.Append('}');
return sb.ToString();
}
public override string ToString()
{
return ToString(this);
}
/// <devdoc>
/// <para>
/// Represents an section of the vector that can contain a integer number.</para>
/// </devdoc>
public struct Section
{
private readonly short _mask;
private readonly short _offset;
internal Section(short mask, short offset)
{
_mask = mask;
_offset = offset;
}
public short Mask
{
get
{
return _mask;
}
}
public short Offset
{
get
{
return _offset;
}
}
public override bool Equals(object o)
{
if (o is Section)
return Equals((Section)o);
else
return false;
}
public bool Equals(Section obj)
{
return obj._mask == _mask && obj._offset == _offset;
}
public static bool operator ==(Section a, Section b)
{
return a.Equals(b);
}
public static bool operator !=(Section a, Section b)
{
return !(a == b);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public static string ToString(Section value)
{
return "Section{0x" + Convert.ToString(value.Mask, 16) + ", 0x" + Convert.ToString(value.Offset, 16) + "}";
}
public override string ToString()
{
return ToString(this);
}
}
}
}

View File

@@ -0,0 +1,346 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Collections.Specialized
{
/// <devdoc>
/// <para>
/// This data structure implements IDictionary first using a linked list
/// (ListDictionary) and then switching over to use Hashtable when large. This is recommended
/// for cases where the number of elements in a dictionary is unknown and might be small.
///
/// It also has a single boolean parameter to allow case-sensitivity that is not affected by
/// ambient culture and has been optimized for looking up case-insensitive symbols
/// </para>
/// </devdoc>
[Serializable]
public class HybridDictionary : IDictionary
{
// These numbers have been carefully tested to be optimal. Please don't change them
// without doing thorough performance testing.
private const int CutoverPoint = 9;
private const int InitialHashtableSize = 13;
private const int FixedSizeCutoverPoint = 6;
// Instance variables. This keeps the HybridDictionary very light-weight when empty
private ListDictionary _list;
private Hashtable _hashtable;
private readonly bool _caseInsensitive;
public HybridDictionary()
{
}
public HybridDictionary(int initialSize) : this(initialSize, false)
{
}
public HybridDictionary(bool caseInsensitive)
{
_caseInsensitive = caseInsensitive;
}
public HybridDictionary(int initialSize, bool caseInsensitive)
{
_caseInsensitive = caseInsensitive;
if (initialSize >= FixedSizeCutoverPoint)
{
if (caseInsensitive)
{
_hashtable = new Hashtable(initialSize, StringComparer.OrdinalIgnoreCase);
}
else
{
_hashtable = new Hashtable(initialSize);
}
}
}
public object this[object key]
{
get
{
// Hashtable supports multiple read, one writer thread safety.
// Although we never made the same guarantee for HybridDictionary,
// it is still nice to do the same thing here since we have recommended
// HybridDictionary as replacement for Hashtable.
ListDictionary cachedList = _list;
if (_hashtable != null)
{
return _hashtable[key];
}
else if (cachedList != null)
{
return cachedList[key];
}
// cachedList can be null in too cases:
// (1) The dictionary is empty, we will return null in this case
// (2) There is writer which is doing ChangeOver. However in that case
// we should see the change to hashtable as well.
// So it should work just fine.
else if (key == null)
{
throw new ArgumentNullException(nameof(key));
}
return null;
}
set
{
if (_hashtable != null)
{
_hashtable[key] = value;
}
else if (_list != null)
{
if (_list.Count >= CutoverPoint - 1)
{
ChangeOver();
_hashtable[key] = value;
}
else
{
_list[key] = value;
}
}
else
{
_list = new ListDictionary(_caseInsensitive ? StringComparer.OrdinalIgnoreCase : null);
_list[key] = value;
}
}
}
private ListDictionary List
{
get
{
if (_list == null)
{
_list = new ListDictionary(_caseInsensitive ? StringComparer.OrdinalIgnoreCase : null);
}
return _list;
}
}
private void ChangeOver()
{
IDictionaryEnumerator en = _list.GetEnumerator();
Hashtable newTable;
if (_caseInsensitive)
{
newTable = new Hashtable(InitialHashtableSize, StringComparer.OrdinalIgnoreCase);
}
else
{
newTable = new Hashtable(InitialHashtableSize);
}
while (en.MoveNext())
{
newTable.Add(en.Key, en.Value);
}
// Keep the order of writing to hashtable and list.
// We assume we will see the change in hashtable if list is set to null in
// this method in another reader thread.
_hashtable = newTable;
_list = null;
}
public int Count
{
get
{
ListDictionary cachedList = _list;
if (_hashtable != null)
{
return _hashtable.Count;
}
else if (cachedList != null)
{
return cachedList.Count;
}
else
{
return 0;
}
}
}
public ICollection Keys
{
get
{
if (_hashtable != null)
{
return _hashtable.Keys;
}
else
{
return List.Keys;
}
}
}
public bool IsReadOnly
{
get
{
return false;
}
}
public bool IsFixedSize
{
get
{
return false;
}
}
public bool IsSynchronized
{
get
{
return false;
}
}
public object SyncRoot
{
get
{
return this;
}
}
public ICollection Values
{
get
{
if (_hashtable != null)
{
return _hashtable.Values;
}
else
{
return List.Values;
}
}
}
public void Add(object key, object value)
{
if (_hashtable != null)
{
_hashtable.Add(key, value);
}
else
{
if (_list == null)
{
_list = new ListDictionary(_caseInsensitive ? StringComparer.OrdinalIgnoreCase : null);
_list.Add(key, value);
}
else if (_list.Count + 1 >= CutoverPoint)
{
ChangeOver();
_hashtable.Add(key, value);
}
else
{
_list.Add(key, value);
}
}
}
public void Clear()
{
if (_hashtable != null)
{
Hashtable cachedHashtable = _hashtable;
_hashtable = null;
cachedHashtable.Clear();
}
if (_list != null)
{
ListDictionary cachedList = _list;
_list = null;
cachedList.Clear();
}
}
public bool Contains(object key)
{
ListDictionary cachedList = _list;
if (_hashtable != null)
{
return _hashtable.Contains(key);
}
else if (cachedList != null)
{
return cachedList.Contains(key);
}
else if (key == null)
{
throw new ArgumentNullException(nameof(key));
}
return false;
}
public void CopyTo(Array array, int index)
{
if (_hashtable != null)
{
_hashtable.CopyTo(array, index);
}
else
{
List.CopyTo(array, index);
}
}
public IDictionaryEnumerator GetEnumerator()
{
if (_hashtable != null)
{
return _hashtable.GetEnumerator();
}
if (_list == null)
{
_list = new ListDictionary(_caseInsensitive ? StringComparer.OrdinalIgnoreCase : null);
}
return _list.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
if (_hashtable != null)
{
return _hashtable.GetEnumerator();
}
if (_list == null)
{
_list = new ListDictionary(_caseInsensitive ? StringComparer.OrdinalIgnoreCase : null);
}
return _list.GetEnumerator();
}
public void Remove(object key)
{
if (_hashtable != null)
{
_hashtable.Remove(key);
}
else if (_list != null)
{
_list.Remove(key);
}
else if (key == null)
{
throw new ArgumentNullException(nameof(key));
}
}
}
}

View File

@@ -0,0 +1,38 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Collections.Specialized
{
/// <devdoc>
/// <para>
/// This interface adds indexing on the IDictionary keyed table concept. Objects
/// added or inserted in an IOrderedDictionary must have both a key and an index, and
/// can be retrieved by either.
/// This interface is useful when preserving easy IDictionary access semantics via a key is
/// desired while ordering is necessary.
/// </para>
/// </devdoc>
public interface IOrderedDictionary : IDictionary
{
// properties
/// <devdoc>
/// Returns the object at the given index
/// </devdoc>
object this[int index] { get; set; }
// Returns an IDictionaryEnumerator for this dictionary.
new IDictionaryEnumerator GetEnumerator();
// methods
/// <devdoc>
/// Inserts the given object, with the given key, at the given index
/// </devdoc>
void Insert(int index, object key, object value);
/// <devdoc>
/// Removes the object and key at the given index
/// </devdoc>
void RemoveAt(int index);
}
}

View File

@@ -0,0 +1,408 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*
* Ordered String/String[] collection of name/value pairs with support for null key
* Wraps NameObject collection
*
*/
using System.Runtime.Serialization;
using System.Text;
namespace System.Collections.Specialized
{
/// <devdoc>
/// <para>Represents a sorted collection of associated <see cref='System.String' qualify='true'/> keys and <see cref='System.String' qualify='true'/> values that
/// can be accessed either with the hash code of the key or with the index.</para>
/// </devdoc>
[Serializable]
public class NameValueCollection : NameObjectCollectionBase
{
private String[] _all;
private String[] _allKeys;
//
// Constructors
//
/// <devdoc>
/// <para>Creates an empty <see cref='System.Collections.Specialized.NameValueCollection'/> with the default initial capacity
/// and using the default case-insensitive hash code provider and the default
/// case-insensitive comparer.</para>
/// </devdoc>
public NameValueCollection() : base()
{
}
/// <devdoc>
/// <para>Copies the entries from the specified <see cref='System.Collections.Specialized.NameValueCollection'/> to a new <see cref='System.Collections.Specialized.NameValueCollection'/> with the same initial capacity as
/// the number of entries copied and using the default case-insensitive hash code
/// provider and the default case-insensitive comparer.</para>
/// </devdoc>
public NameValueCollection(NameValueCollection col)
: base(col != null ? col.Comparer : null)
{
Add(col);
}
[Obsolete("Please use NameValueCollection(IEqualityComparer) instead.")]
public NameValueCollection(IHashCodeProvider hashProvider, IComparer comparer)
: base(hashProvider, comparer) {
}
/// <devdoc>
/// <para>Creates an empty <see cref='System.Collections.Specialized.NameValueCollection'/> with
/// the specified initial capacity and using the default case-insensitive hash code
/// provider and the default case-insensitive comparer.</para>
/// </devdoc>
public NameValueCollection(int capacity) : base(capacity)
{
}
public NameValueCollection(IEqualityComparer equalityComparer) : base(equalityComparer)
{
}
public NameValueCollection(Int32 capacity, IEqualityComparer equalityComparer)
: base(capacity, equalityComparer)
{
}
/// <devdoc>
/// <para>Copies the entries from the specified <see cref='System.Collections.Specialized.NameValueCollection'/> to a new <see cref='System.Collections.Specialized.NameValueCollection'/> with the specified initial capacity or the
/// same initial capacity as the number of entries copied, whichever is greater, and
/// using the default case-insensitive hash code provider and the default
/// case-insensitive comparer.</para>
/// </devdoc>
public NameValueCollection(int capacity, NameValueCollection col)
: base(capacity, (col != null ? col.Comparer : null))
{
if (col == null)
{
throw new ArgumentNullException(nameof(col));
}
this.Comparer = col.Comparer;
Add(col);
}
[Obsolete("Please use NameValueCollection(Int32, IEqualityComparer) instead.")]
public NameValueCollection(int capacity, IHashCodeProvider hashProvider, IComparer comparer)
: base(capacity, hashProvider, comparer) {
}
protected NameValueCollection(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
//
// Helper methods
//
/// <devdoc>
/// <para> Resets the cached arrays of the collection to <see langword='null'/>.</para>
/// </devdoc>
protected void InvalidateCachedArrays()
{
_all = null;
_allKeys = null;
}
private static String GetAsOneString(ArrayList list)
{
int n = (list != null) ? list.Count : 0;
if (n == 1)
{
return (String)list[0];
}
else if (n > 1)
{
StringBuilder s = new StringBuilder((String)list[0]);
for (int i = 1; i < n; i++)
{
s.Append(',');
s.Append((String)list[i]);
}
return s.ToString();
}
else
{
return null;
}
}
private static String[] GetAsStringArray(ArrayList list)
{
int n = (list != null) ? list.Count : 0;
if (n == 0)
return null;
String[] array = new String[n];
list.CopyTo(0, array, 0, n);
return array;
}
//
// Misc public APIs
//
/// <devdoc>
/// <para>Copies the entries in the specified <see cref='System.Collections.Specialized.NameValueCollection'/> to the current <see cref='System.Collections.Specialized.NameValueCollection'/>.</para>
/// </devdoc>
public void Add(NameValueCollection c)
{
if (c == null)
{
throw new ArgumentNullException(nameof(c));
}
InvalidateCachedArrays();
int n = c.Count;
for (int i = 0; i < n; i++)
{
String key = c.GetKey(i);
String[] values = c.GetValues(i);
if (values != null)
{
for (int j = 0; j < values.Length; j++)
Add(key, values[j]);
}
else
{
Add(key, null);
}
}
}
/// <devdoc>
/// <para>Invalidates the cached arrays and removes all entries
/// from the <see cref='System.Collections.Specialized.NameValueCollection'/>.</para>
/// </devdoc>
public virtual void Clear()
{
if (IsReadOnly)
throw new NotSupportedException(SR.CollectionReadOnly);
InvalidateCachedArrays();
BaseClear();
}
public void CopyTo(Array dest, int index)
{
if (dest == null)
{
throw new ArgumentNullException(nameof(dest));
}
if (dest.Rank != 1)
{
throw new ArgumentException(SR.Arg_MultiRank, nameof(dest));
}
if (index < 0)
{
throw new ArgumentOutOfRangeException(nameof(index), index, SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (dest.Length - index < Count)
{
throw new ArgumentException(SR.Arg_InsufficientSpace);
}
int n = Count;
if (_all == null)
{
String[] all = new String[n];
for (int i = 0; i < n; i++)
{
all[i] = Get(i);
dest.SetValue(all[i], i + index);
}
_all = all; // wait until end of loop to set _all reference in case Get throws
}
else
{
for (int i = 0; i < n; i++)
{
dest.SetValue(_all[i], i + index);
}
}
}
/// <devdoc>
/// <para>Gets a value indicating whether the <see cref='System.Collections.Specialized.NameValueCollection'/> contains entries whose keys are not <see langword='null'/>.</para>
/// </devdoc>
public bool HasKeys()
{
return InternalHasKeys();
}
/// <devdoc>
/// <para>Allows derived classes to alter HasKeys().</para>
/// </devdoc>
internal virtual bool InternalHasKeys()
{
return BaseHasKeys();
}
//
// Access by name
//
/// <devdoc>
/// <para>Adds an entry with the specified name and value into the
/// <see cref='System.Collections.Specialized.NameValueCollection'/>.</para>
/// </devdoc>
public virtual void Add(String name, String value)
{
if (IsReadOnly)
throw new NotSupportedException(SR.CollectionReadOnly);
InvalidateCachedArrays();
ArrayList values = (ArrayList)BaseGet(name);
if (values == null)
{
// new key - add new key with single value
values = new ArrayList(1);
if (value != null)
values.Add(value);
BaseAdd(name, values);
}
else
{
// old key -- append value to the list of values
if (value != null)
values.Add(value);
}
}
/// <devdoc>
/// <para> Gets the values associated with the specified key from the <see cref='System.Collections.Specialized.NameValueCollection'/> combined into one comma-separated list.</para>
/// </devdoc>
public virtual String Get(String name)
{
ArrayList values = (ArrayList)BaseGet(name);
return GetAsOneString(values);
}
/// <devdoc>
/// <para>Gets the values associated with the specified key from the <see cref='System.Collections.Specialized.NameValueCollection'/>.</para>
/// </devdoc>
public virtual String[] GetValues(String name)
{
ArrayList values = (ArrayList)BaseGet(name);
return GetAsStringArray(values);
}
/// <devdoc>
/// <para>Adds a value to an entry in the <see cref='System.Collections.Specialized.NameValueCollection'/>.</para>
/// </devdoc>
public virtual void Set(String name, String value)
{
if (IsReadOnly)
throw new NotSupportedException(SR.CollectionReadOnly);
InvalidateCachedArrays();
ArrayList values = new ArrayList(1);
values.Add(value);
BaseSet(name, values);
}
/// <devdoc>
/// <para>Removes the entries with the specified key from the <see cref='System.Collections.Specialized.NameObjectCollectionBase'/> instance.</para>
/// </devdoc>
public virtual void Remove(String name)
{
InvalidateCachedArrays();
BaseRemove(name);
}
/// <devdoc>
/// <para> Represents the entry with the specified key in the
/// <see cref='System.Collections.Specialized.NameValueCollection'/>.</para>
/// </devdoc>
public String this[String name]
{
get
{
return Get(name);
}
set
{
Set(name, value);
}
}
//
// Indexed access
//
/// <devdoc>
/// <para>
/// Gets the values at the specified index of the <see cref='System.Collections.Specialized.NameValueCollection'/> combined into one
/// comma-separated list.</para>
/// </devdoc>
public virtual String Get(int index)
{
ArrayList values = (ArrayList)BaseGet(index);
return GetAsOneString(values);
}
/// <devdoc>
/// <para> Gets the values at the specified index of the <see cref='System.Collections.Specialized.NameValueCollection'/>.</para>
/// </devdoc>
public virtual String[] GetValues(int index)
{
ArrayList values = (ArrayList)BaseGet(index);
return GetAsStringArray(values);
}
/// <devdoc>
/// <para>Gets the key at the specified index of the <see cref='System.Collections.Specialized.NameValueCollection'/>.</para>
/// </devdoc>
public virtual String GetKey(int index)
{
return BaseGetKey(index);
}
/// <devdoc>
/// <para>Represents the entry at the specified index of the <see cref='System.Collections.Specialized.NameValueCollection'/>.</para>
/// </devdoc>
public String this[int index]
{
get
{
return Get(index);
}
}
//
// Access to keys and values as arrays
//
/// <devdoc>
/// <para>Gets all the keys in the <see cref='System.Collections.Specialized.NameValueCollection'/>. </para>
/// </devdoc>
public virtual String[] AllKeys
{
get
{
if (_allKeys == null)
_allKeys = BaseGetAllKeys();
return _allKeys;
}
}
}
}

View File

@@ -0,0 +1,267 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Collections.Specialized
{
/// <devdoc>
/// <para>Represents a collection of strings.</para>
/// </devdoc>
[Serializable]
public class StringCollection : IList
{
private readonly ArrayList _data = new ArrayList();
/// <devdoc>
/// <para>Represents the entry at the specified index of the <see cref='System.Collections.Specialized.StringCollection'/>.</para>
/// </devdoc>
public string this[int index]
{
get
{
return ((string)_data[index]);
}
set
{
_data[index] = value;
}
}
/// <devdoc>
/// <para>Gets the number of strings in the
/// <see cref='System.Collections.Specialized.StringCollection'/> .</para>
/// </devdoc>
public int Count
{
get
{
return _data.Count;
}
}
bool IList.IsReadOnly
{
get
{
return false;
}
}
bool IList.IsFixedSize
{
get
{
return false;
}
}
/// <devdoc>
/// <para>Adds a string with the specified value to the
/// <see cref='System.Collections.Specialized.StringCollection'/> .</para>
/// </devdoc>
public int Add(string value)
{
return _data.Add(value);
}
/// <devdoc>
/// <para>Copies the elements of a string array to the end of the <see cref='System.Collections.Specialized.StringCollection'/>.</para>
/// </devdoc>
public void AddRange(string[] value)
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
_data.AddRange(value);
}
/// <devdoc>
/// <para>Removes all the strings from the
/// <see cref='System.Collections.Specialized.StringCollection'/> .</para>
/// </devdoc>
public void Clear()
{
_data.Clear();
}
/// <devdoc>
/// <para>Gets a value indicating whether the
/// <see cref='System.Collections.Specialized.StringCollection'/> contains a string with the specified
/// value.</para>
/// </devdoc>
public bool Contains(string value)
{
return _data.Contains(value);
}
/// <devdoc>
/// <para>Copies the <see cref='System.Collections.Specialized.StringCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
/// specified index.</para>
/// </devdoc>
public void CopyTo(string[] array, int index)
{
_data.CopyTo(array, index);
}
/// <devdoc>
/// <para>Returns an enumerator that can iterate through
/// the <see cref='System.Collections.Specialized.StringCollection'/> .</para>
/// </devdoc>
public StringEnumerator GetEnumerator()
{
return new StringEnumerator(this);
}
/// <devdoc>
/// <para>Returns the index of the first occurrence of a string in
/// the <see cref='System.Collections.Specialized.StringCollection'/> .</para>
/// </devdoc>
public int IndexOf(string value)
{
return _data.IndexOf(value);
}
/// <devdoc>
/// <para>Inserts a string into the <see cref='System.Collections.Specialized.StringCollection'/> at the specified
/// index.</para>
/// </devdoc>
public void Insert(int index, string value)
{
_data.Insert(index, value);
}
/// <devdoc>
/// <para>Gets a value indicating whether the <see cref='System.Collections.Specialized.StringCollection'/> is read-only.</para>
/// </devdoc>
public bool IsReadOnly
{
get
{
return false;
}
}
/// <devdoc>
/// <para>Gets a value indicating whether access to the
/// <see cref='System.Collections.Specialized.StringCollection'/>
/// is synchronized (thread-safe).</para>
/// </devdoc>
public bool IsSynchronized
{
get
{
return false;
}
}
/// <devdoc>
/// <para> Removes a specific string from the
/// <see cref='System.Collections.Specialized.StringCollection'/> .</para>
/// </devdoc>
public void Remove(string value)
{
_data.Remove(value);
}
/// <devdoc>
/// <para>Removes the string at the specified index of the <see cref='System.Collections.Specialized.StringCollection'/>.</para>
/// </devdoc>
public void RemoveAt(int index)
{
_data.RemoveAt(index);
}
/// <devdoc>
/// <para>Gets an object that can be used to synchronize access to the <see cref='System.Collections.Specialized.StringCollection'/>.</para>
/// </devdoc>
public object SyncRoot
{
get
{
return _data.SyncRoot;
}
}
object IList.this[int index]
{
get
{
return this[index];
}
set
{
this[index] = (string)value;
}
}
int IList.Add(object value)
{
return Add((string)value);
}
bool IList.Contains(object value)
{
return Contains((string)value);
}
int IList.IndexOf(object value)
{
return IndexOf((string)value);
}
void IList.Insert(int index, object value)
{
Insert(index, (string)value);
}
void IList.Remove(object value)
{
Remove((string)value);
}
void ICollection.CopyTo(Array array, int index)
{
_data.CopyTo(array, index);
}
IEnumerator IEnumerable.GetEnumerator()
{
return _data.GetEnumerator();
}
}
public class StringEnumerator
{
private System.Collections.IEnumerator _baseEnumerator;
private System.Collections.IEnumerable _temp;
internal StringEnumerator(StringCollection mappings)
{
_temp = (IEnumerable)(mappings);
_baseEnumerator = _temp.GetEnumerator();
}
public string Current
{
get
{
return (string)(_baseEnumerator.Current);
}
}
public bool MoveNext()
{
return _baseEnumerator.MoveNext();
}
public void Reset()
{
_baseEnumerator.Reset();
}
}
}

View File

@@ -0,0 +1,189 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Collections.Specialized
{
/// <devdoc>
/// <para>Implements a hashtable with the key strongly typed to be
/// a string rather than an object. </para>
/// <para>Consider this class obsolete - use Dictionary&lt;String, String&gt; instead
/// with a proper StringComparer instance.</para>
/// </devdoc>
[Serializable]
public class StringDictionary : IEnumerable
{
// For compatibility, we want the Keys property to return values in lower-case.
// That means using ToLower in each property on this type. Also for backwards
// compatibility, we will be converting strings to lower-case, which has a
// problem for some Georgian alphabets.
private readonly Hashtable _contents = new Hashtable();
/// <devdoc>
/// <para>Initializes a new instance of the StringDictionary class.</para>
/// <para>If you're using file names, registry keys, etc, you want to use
/// a Dictionary&lt;String, Object&gt; and use
/// StringComparer.OrdinalIgnoreCase.</para>
/// </devdoc>
public StringDictionary()
{
}
/// <devdoc>
/// <para>Gets the number of key-and-value pairs in the StringDictionary.</para>
/// </devdoc>
public virtual int Count
{
get
{
return _contents.Count;
}
}
/// <devdoc>
/// <para>Indicates whether access to the StringDictionary is synchronized (thread-safe). This property is
/// read-only.</para>
/// </devdoc>
public virtual bool IsSynchronized
{
get
{
return _contents.IsSynchronized;
}
}
/// <devdoc>
/// <para>Gets or sets the value associated with the specified key.</para>
/// </devdoc>
public virtual string this[string key]
{
get
{
if (key == null)
{
throw new ArgumentNullException(nameof(key));
}
return (string)_contents[key.ToLowerInvariant()];
}
set
{
if (key == null)
{
throw new ArgumentNullException(nameof(key));
}
_contents[key.ToLowerInvariant()] = value;
}
}
/// <devdoc>
/// <para>Gets a collection of keys in the StringDictionary.</para>
/// </devdoc>
public virtual ICollection Keys
{
get
{
return _contents.Keys;
}
}
/// <devdoc>
/// <para>Gets an object that can be used to synchronize access to the StringDictionary.</para>
/// </devdoc>
public virtual object SyncRoot
{
get
{
return _contents.SyncRoot;
}
}
/// <devdoc>
/// <para>Gets a collection of values in the StringDictionary.</para>
/// </devdoc>
public virtual ICollection Values
{
get
{
return _contents.Values;
}
}
/// <devdoc>
/// <para>Adds an entry with the specified key and value into the StringDictionary.</para>
/// </devdoc>
public virtual void Add(string key, string value)
{
if (key == null)
{
throw new ArgumentNullException(nameof(key));
}
_contents.Add(key.ToLowerInvariant(), value);
}
/// <devdoc>
/// <para>Removes all entries from the StringDictionary.</para>
/// </devdoc>
public virtual void Clear()
{
_contents.Clear();
}
/// <devdoc>
/// <para>Determines if the string dictionary contains a specific key</para>
/// </devdoc>
public virtual bool ContainsKey(string key)
{
if (key == null)
{
throw new ArgumentNullException(nameof(key));
}
return _contents.ContainsKey(key.ToLowerInvariant());
}
/// <devdoc>
/// <para>Determines if the StringDictionary contains a specific value.</para>
/// </devdoc>
public virtual bool ContainsValue(string value)
{
return _contents.ContainsValue(value);
}
/// <devdoc>
/// <para>Copies the string dictionary values to a one-dimensional <see cref='System.Array'/> instance at the
/// specified index.</para>
/// </devdoc>
public virtual void CopyTo(Array array, int index)
{
_contents.CopyTo(array, index);
}
/// <devdoc>
/// <para>Returns an enumerator that can iterate through the string dictionary.</para>
/// </devdoc>
public virtual IEnumerator GetEnumerator()
{
return _contents.GetEnumerator();
}
/// <devdoc>
/// <para>Removes the entry with the specified key from the string dictionary.</para>
/// </devdoc>
public virtual void Remove(string key)
{
if (key == null)
{
throw new ArgumentNullException(nameof(key));
}
_contents.Remove(key.ToLowerInvariant());
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netstandard1.3;
netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,57 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Collections.Specialized.Tests
{
public static class Helpers
{
public static MyNameObjectCollection CreateNameObjectCollection(int count)
{
MyNameObjectCollection nameObjectCollection = new MyNameObjectCollection();
for (int i = 0; i < count; i++)
{
nameObjectCollection.Add("Name_" + i, new Foo("Value_" + i));
}
return nameObjectCollection;
}
public static NameValueCollection CreateNameValueCollection(int count, int start = 0)
{
NameValueCollection nameValueCollection = new NameValueCollection();
for (int i = start; i < start + count; i++)
{
nameValueCollection.Add("Name_" + i, "Value_" + i);
}
return nameValueCollection;
}
public static StringDictionary CreateStringDictionary(int count)
{
StringDictionary stringDictionary = new StringDictionary();
for (int i = 0; i < count; i++)
{
stringDictionary.Add("Key_" + i, "Value_" + i);
}
return stringDictionary;
}
public static HybridDictionary CreateHybridDictionary(int count, bool caseInsensitive = false)
{
HybridDictionary hybridDictionary = new HybridDictionary(caseInsensitive);
for (int i = 0; i < count; i++)
{
hybridDictionary.Add("Key_" + i, "Value_" + i);
}
return hybridDictionary;
}
}
}

Some files were not shown because too many files have changed in this diff Show More