﻿// Decompiled with JetBrains decompiler
// Type: System.Xml.Serialization.NameTable
// Assembly: System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 50ABAB51-7DC3-4F0A-A797-0D0C2D124D60
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Xml.dll

using System;
using System.Collections;
using System.Xml;

namespace System.Xml.Serialization
{
  internal class NameTable : INameScope
  {
    private Hashtable table = new Hashtable();

    internal object this[XmlQualifiedName qname]
    {
      get
      {
        return this.table[(object) new NameKey(qname.Name, qname.Namespace)];
      }
      set
      {
        this.table[(object) new NameKey(qname.Name, qname.Namespace)] = value;
      }
    }

    internal object this[string name, string ns]
    {
      get
      {
        return this.table[(object) new NameKey(name, ns)];
      }
      set
      {
        this.table[(object) new NameKey(name, ns)] = value;
      }
    }

    object INameScope.this[string name, string ns]
    {
      get
      {
        return this.table[(object) new NameKey(name, ns)];
      }
      set
      {
        this.table[(object) new NameKey(name, ns)] = value;
      }
    }

    internal ICollection Values
    {
      get
      {
        return this.table.Values;
      }
    }

    internal void Add(XmlQualifiedName qname, object value)
    {
      this.Add(qname.Name, qname.Namespace, value);
    }

    internal void Add(string name, string ns, object value)
    {
      this.table.Add((object) new NameKey(name, ns), value);
    }

    internal Array ToArray(Type type)
    {
      Array instance = Array.CreateInstance(type, this.table.Count);
      this.table.Values.CopyTo(instance, 0);
      return instance;
    }
  }
}
