﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Configuration.FullTrustAssemblyCollection
// Assembly: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 7E68A73E-4066-4F24-AB0A-F147209F50EC
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Web.dll

using System.Configuration;
using System.Runtime;

namespace System.Web.Configuration
{
  /// <summary>
  /// Represents a collection of <see cref="T:System.Web.Configuration.FullTrustAssembly"/> objects. This class cannot be inherited.
  /// </summary>
  [ConfigurationCollection(typeof (string))]
  public sealed class FullTrustAssemblyCollection : ConfigurationElementCollection
  {
    private static ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection();

    protected override ConfigurationPropertyCollection Properties
    {
      [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")] get
      {
        return FullTrustAssemblyCollection._properties;
      }
    }

    /// <summary>
    /// Gets the <see cref="T:System.Web.Configuration.FullTrustAssembly"/> object from the collection at the specified index.
    /// </summary>
    /// 
    /// <returns>
    /// The element at the specified index.
    /// </returns>
    /// <param name="index">The collection element index.</param>
    public FullTrustAssembly this[int index]
    {
      get
      {
        return (FullTrustAssembly) this.BaseGet(index);
      }
      set
      {
        if (this.BaseGet(index) != null)
          this.BaseRemoveAt(index);
        this.BaseAdd(index, (ConfigurationElement) value);
      }
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:System.Web.Configuration.FullTrustAssemblyCollection"/> class.
    /// </summary>
    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    public FullTrustAssemblyCollection()
    {
    }

    /// <summary>
    /// Adds a <see cref="T:System.Web.Configuration.FullTrustAssembly"/> object to the collection.
    /// </summary>
    /// <param name="fullTrustAssembly">The object to add to the collection.</param>
    public void Add(FullTrustAssembly fullTrustAssembly)
    {
      this.BaseAdd((ConfigurationElement) fullTrustAssembly);
    }

    /// <summary>
    /// Removes the specified <see cref="T:System.Web.Configuration.FullTrustAssembly"/> object from the collection.
    /// </summary>
    /// <param name="key">The key of the element to remove from the collection.</param>
    public void Remove(string key)
    {
      this.BaseRemove((object) key);
    }

    /// <summary>
    /// Removes the <see cref="T:System.Web.Configuration.FullTrustAssembly"/> object from the collection at the specified index.
    /// </summary>
    /// <param name="index">The index of the element to remove from the collection.</param>
    public void RemoveAt(int index)
    {
      this.BaseRemoveAt(index);
    }

    protected override ConfigurationElement CreateNewElement()
    {
      return (ConfigurationElement) new FullTrustAssembly();
    }

    /// <summary>
    /// Removes all the <see cref="T:System.Web.Configuration.FullTrustAssembly"/> objects from the collection.
    /// </summary>
    public void Clear()
    {
      this.BaseClear();
    }

    protected override object GetElementKey(ConfigurationElement element)
    {
      return (object) (((FullTrustAssembly) element).AssemblyName + ((FullTrustAssembly) element).Version);
    }

    internal bool IsRemoved(string key)
    {
      return this.BaseIsRemoved((object) key);
    }
  }
}
