Aracılığıyla paylaş


HttpModuleCollection Sınıf

Tanım

Bir nesne koleksiyonunu IHttpModule dizine almak ve almak için bir yol sağlar.

public ref class HttpModuleCollection sealed : System::Collections::Specialized::NameObjectCollectionBase
public sealed class HttpModuleCollection : System.Collections.Specialized.NameObjectCollectionBase
type HttpModuleCollection = class
    inherit NameObjectCollectionBase
Public NotInheritable Class HttpModuleCollection
Inherits NameObjectCollectionBase
Devralma
HttpModuleCollection

Örnekler

Aşağıdaki kod örneği, sınıfın AllKeys özelliğini ve GetKey ve CopyTo yöntemlerini HttpModuleCollection gösterir. Örnek, geçerli nesneden HttpContext geçerli istek için uygulama nesnesini alır. Ardından uygulama örneğinden nesnesini ayıklar HttpModuleCollection ve nesnelerin adlarını IHttpModule görüntüler.

<%@ Page language="C#" %>
<%@ Import Namespace = "System.Data"  %>
<script runat="server">
// System.Web.HttpModuleCollection.AllKeys;GetKey;CopyTo

void Page_Load(object sender, System.EventArgs e)
{
    // Get the HttpContext object for the current request.
    HttpContext myHttpContext = HttpContext.Current;
    // Get the application object for the current request.
    HttpApplication myHttpApplication = myHttpContext.ApplicationInstance;
    // Get the collection of all HTTPModule objects for the current application.
    HttpModuleCollection myHttpModuleCollection = myHttpApplication.Modules;

    // Get the name of the HttpModule object at index 1.
    string httpModuleName = myHttpModuleCollection.GetKey(1);
    Response.Write("The name of the HttpModule object at index 1" + " is " +"'"+  httpModuleName+"'." + "<br><br>"); 

    string[] allModules = myHttpModuleCollection.AllKeys;

    // Display the names of all HttpModule objects.
    Response.Write("<b>The HttpModule objects contained in the HttpModuleCollection are:</b><br>");

    for(int i=0; i < allModules.Length; i++)
       Response.Write("Module" + i + "  : " + allModules[i] + "<br>");

    // Copy the HttpModule objects in the collection into an array.
    System.Array httpModuleArray = Array.CreateInstance(typeof(object),myHttpModuleCollection.AllKeys.Length);
    myHttpModuleCollection.CopyTo(httpModuleArray,0);
    Response.Write("<br><br><b>Successfully copied the HttpModule objects in the HttpModuleCollection to an array."+
       "<br>Displaying the HttpModule objects in array:</b><br>");

    for(int i=0; i < httpModuleArray.Length; i++)
       Response.Write("Module" + i + ": " + httpModuleArray.GetValue(i) + "<br>");

}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>HttpModuleCollection Example</title>
</head>
<body>
</body>
</html>
<%@ Page language="VB" %>
<%@ Import Namespace = "System.Data"  %>

<script runat="server">
' System.Web.HttpModuleCollection.AllKeys;GetKey;CopyTo
Sub Page_Load(Sender As Object, e As EventArgs )

' Get the HttpContext object for the current request.
Dim i As Integer
Dim myHttpContext As HttpContext  = HttpContext.Current
' Get the application object for the current request.
Dim  myHttpApplication As HttpApplication = myHttpContext.ApplicationInstance
' Get the collection of all HTTPModule objects for the current application.
Dim myHttpModuleCollection As HttpModuleCollection = myHttpApplication.Modules
       
' Get the name of the HttpModule object at index 1.
Dim httpModuleName As string = myHttpModuleCollection.GetKey(1)
Response.Write("The name of the HttpModule object at index 1" + " is " +"'"+  httpModuleName+"'." + "<br><br>")
      
Dim  allModules() As string = myHttpModuleCollection.AllKeys
      
' Display the names of all HttpModule objects.
Response.Write("<b>The HttpModule objects of HttpModuleCollection are:</b><br>")

For i = 0 To allModules.Length -1 
   Response.Write("Module" + i.ToString() + "  : " + allModules(i).ToString() + "<br>")
Next i


' Copy the HttpModule objects in the collection into an array.    
Dim httpModuleArray As System.Array = Array.CreateInstance(GetType(object),myHttpModuleCollection.AllKeys.Length)
myHttpModuleCollection.CopyTo(httpModuleArray,0)
Response.Write("<br><br><b>Successfully copied the HttpModule objects in the HttpModuleCollection to an array."+ "<br>Displaying the HttpModule objects in the array:</b><br>")

For i=0 To httpModuleArray.Length -1
   Response.Write("Module" + i.ToString() + ": " + httpModuleArray.GetValue(i).ToString() + "<br>")
Next i

End Sub
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>HttpModuleCollection Example</title>
</head>
<body>
</body>
</html>

Özellikler

Name Description
AllKeys

içindeki HttpModuleCollectiontüm anahtarları (modül adları) içeren bir dize dizisi alır.

Count

Örnekte bulunan anahtar/değer çiftlerinin NameObjectCollectionBase sayısını alır.

(Devralındığı yer: NameObjectCollectionBase)
IsReadOnly

Örneğin salt okunur olup olmadığını NameObjectCollectionBase belirten bir değer alır veya ayarlar.

(Devralındığı yer: NameObjectCollectionBase)
Item[Int32]

IHttpModule öğesinden HttpModuleCollectionbelirtilen sayısal dizine sahip nesneyi alır.

Item[String]

IHttpModule öğesinden HttpModuleCollectionbelirtilen ada sahip nesneyi alır.

Keys

Örnekteki tüm anahtarları NameObjectCollectionBase içeren bir NameObjectCollectionBase.KeysCollection örneği alır.

(Devralındığı yer: NameObjectCollectionBase)

Yöntemler

Name Description
BaseAdd(String, Object)

Örneğe belirtilen anahtar ve değere NameObjectCollectionBase sahip bir girdi ekler.

(Devralındığı yer: NameObjectCollectionBase)
BaseClear()

Örnekteki NameObjectCollectionBase tüm girişleri kaldırır.

(Devralındığı yer: NameObjectCollectionBase)
BaseGet(Int32)

Örneğin belirtilen dizinindeki girdinin NameObjectCollectionBase değerini alır.

(Devralındığı yer: NameObjectCollectionBase)
BaseGet(String)

Örnekten belirtilen anahtara sahip ilk girdinin NameObjectCollectionBase değerini alır.

(Devralındığı yer: NameObjectCollectionBase)
BaseGetAllKeys()

Örnekteki tüm anahtarları String içeren bir NameObjectCollectionBase dizi döndürür.

(Devralındığı yer: NameObjectCollectionBase)
BaseGetAllValues()

Örnekteki tüm değerleri Object içeren bir NameObjectCollectionBase dizi döndürür.

(Devralındığı yer: NameObjectCollectionBase)
BaseGetAllValues(Type)

Örnekteki tüm değerleri NameObjectCollectionBase içeren belirtilen türde bir dizi döndürür.

(Devralındığı yer: NameObjectCollectionBase)
BaseGetKey(Int32)

Örneğin belirtilen dizininde girdinin NameObjectCollectionBase anahtarını alır.

(Devralındığı yer: NameObjectCollectionBase)
BaseHasKeys()

Örneğin anahtarları olmayan NameObjectCollectionBasegirdiler içerip içermediğini null belirten bir değer alır.

(Devralındığı yer: NameObjectCollectionBase)
BaseRemove(String)

Belirtilen anahtara sahip girişleri örnekten NameObjectCollectionBase kaldırır.

(Devralındığı yer: NameObjectCollectionBase)
BaseRemoveAt(Int32)

Örneğin belirtilen dizinindeki girdiyi NameObjectCollectionBase kaldırır.

(Devralındığı yer: NameObjectCollectionBase)
BaseSet(Int32, Object)

Girdinin değerini örneğin belirtilen dizininde NameObjectCollectionBase ayarlar.

(Devralındığı yer: NameObjectCollectionBase)
BaseSet(String, Object)

Örnekte belirtilen anahtarla NameObjectCollectionBase ilk girdinin değerini ayarlar; bulunursa, aksi takdirde örneğe belirtilen anahtar ve değere NameObjectCollectionBase sahip bir girdi ekler.

(Devralındığı yer: NameObjectCollectionBase)
CopyTo(Array, Int32)

Modül koleksiyonunun üyelerini dizinin belirtilen dizininden başlayarak bir Arrayöğesine kopyalar.

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
Get(Int32)

IHttpModule öğesinden HttpModuleCollectionbelirtilen dizine sahip nesneyi döndürür.

Get(String)

öğesinden IHttpModuleHttpModuleCollectionbelirtilen ada sahip nesneyi döndürür.

GetEnumerator()

aracılığıyla NameObjectCollectionBaseyineleyen bir numaralandırıcı döndürür.

(Devralındığı yer: NameObjectCollectionBase)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetKey(Int32)

Belirtilen sayısal dizindeki nesnenin IHttpModule anahtarını (adını) döndürür.

GetObjectData(SerializationInfo, StreamingContext)
Geçersiz.

Arabirimini ISerializable uygular ve örneği serileştirmek NameObjectCollectionBase için gereken verileri döndürür.

(Devralındığı yer: NameObjectCollectionBase)
GetType()

Geçerli örneğin Type alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectbasit bir kopyasını oluşturur.

(Devralındığı yer: Object)
OnDeserialization(Object)

Arabirimini ISerializable uygular ve seri durumdan çıkarma işlemi tamamlandığında seri durumdan çıkarma olayını başlatır.

(Devralındığı yer: NameObjectCollectionBase)
ToString()

Geçerli nesneyi temsil eden bir dize döndürür.

(Devralındığı yer: Object)

Belirtik Arabirim Kullanımları

Name Description
ICollection.CopyTo(Array, Int32)

Hedef dizinin belirtilen dizininden başlayarak tamamını NameObjectCollectionBase uyumlu bir tek boyutluya Arraykopyalar.

(Devralındığı yer: NameObjectCollectionBase)
ICollection.IsSynchronized

Nesneye erişimin NameObjectCollectionBase eşitlenip eşitlenmediğini belirten bir değer alır (iş parçacığı güvenli).

(Devralındığı yer: NameObjectCollectionBase)
ICollection.SyncRoot

Nesneye erişimi NameObjectCollectionBase eşitlemek için kullanılabilecek bir nesne alır.

(Devralındığı yer: NameObjectCollectionBase)

Uzantı Metotları

Name Description
AsParallel(IEnumerable)

Sorgunun paralelleştirilmesini etkinleştirir.

AsQueryable(IEnumerable)

bir IEnumerable öğesine IQueryabledönüştürür.

Cast<TResult>(IEnumerable)

öğesinin IEnumerable öğelerini belirtilen türe yazar.

OfType<TResult>(IEnumerable)

Belirtilen türe göre bir IEnumerable öğesinin öğelerini filtreler.

Şunlara uygulanır