1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
//------------------------------------------------------------------------------
// <copyright file="HttpModuleCollection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
/*
* Collection of IHttpModules
*
* Copyright (c) 2000 Microsoft Corporation
*/
namespace System.Web {
using System.Runtime.InteropServices;
using System.Collections;
using System.Collections.Specialized;
using System.Web;
using System.Web.Util;
using System.Security.Permissions;
/// <devdoc>
/// <para>A collection of IHttpModules</para>
/// </devdoc>
public sealed class HttpModuleCollection : NameObjectCollectionBase {
// cached All[] arrays
private IHttpModule[] _all;
private String[] _allKeys;
internal HttpModuleCollection() : base(Misc.CaseInsensitiveInvariantKeyComparer) {
}
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public void CopyTo(Array dest, int index) {
if (_all == null) {
int n = Count;
_all = new IHttpModule[n];
for (int i = 0; i < n; i++)
_all[i] = Get(i);
}
if (_all != null) {
_all.CopyTo(dest, index);
}
}
internal void AddModule(String name, IHttpModule m) {
_all = null;
_allKeys = null;
BaseAdd(name, m);
}
internal void AppendCollection(HttpModuleCollection other) {
// appends another collection to this instance (mutates this instance)
for (int i = 0; i < other.Count; i++) {
AddModule(other.BaseGetKey(i), other.Get(i));
}
}
//
// Access by name
//
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public IHttpModule Get(String name) {
return(IHttpModule)BaseGet(name);
}
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public IHttpModule this[String name]
{
get { return Get(name);}
}
//
// Indexed access
//
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public IHttpModule Get(int index) {
return(IHttpModule)BaseGet(index);
}
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public String GetKey(int index) {
return BaseGetKey(index);
}
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public IHttpModule this[int index]
{
get { return Get(index);}
}
//
// Access to keys and values as arrays
//
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public String[] AllKeys {
get {
if (_allKeys == null)
_allKeys = BaseGetAllKeys();
return _allKeys;
}
}
}
}
|