EmptyControlCollection 클래스

정의

항상 비어 있는 컬렉션에 ControlCollection 대한 표준 지원을 제공합니다.

public ref class EmptyControlCollection : System::Web::UI::ControlCollection
public class EmptyControlCollection : System.Web.UI.ControlCollection
type EmptyControlCollection = class
    inherit ControlCollection
Public Class EmptyControlCollection
Inherits ControlCollection
상속
EmptyControlCollection

예제


/* File name: emptyControlCollection.cs. */

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

namespace CustomControls
{

  // Defines a simple custom control.
  public class MyCS_EmptyControl : Control
  {
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 
    protected override ControlCollection CreateControlCollection() 
    /*
     * Function Name: CreateControlCollection.
     * Denies the creation of any child control by creating an empty collection.
     * Generates an exception if an attempt to create a child control is made.
     */
     {
       return new EmptyControlCollection(this);
     }
     
     [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 
     protected override void CreateChildControls()
     /*
      * Function Name: CreateChildControls.
      * Populates the child control collection (Controls). 
      * Note: This function will cause an exception because the control does not allow 
      * child controls.
      */
      {
        // Create a literal control to contain the header and add it to the collection.
        LiteralControl text;
        text = new LiteralControl("<h5>Composite Controls</h5>");
        Controls.Add(text);
      }
   }
}

' File name: emptyControlCollection.vb.

Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Collections


Namespace CustomControls 

  Public Class MyVB_EmptyControl 
    Inherits Control
    
    <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
    Protected Overrides Function CreateControlCollection() As ControlCollection
    ' Function Name: CreateControlCollection.
    ' Denies the creation of any child control by creating an empty collection.
    ' Generates an exception if an attempt to create a child control is made.
      Return New EmptyControlCollection(Me)
    End Function 
    
    <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _  
    Protected Overrides Sub CreateChildControls()
    ' Sub Name: CreateChildControls.
    ' Populates the child control collection (Controls). 
    ' Note: This function will cause an exception because the control does not allow 
    ' child controls.
      Dim text As LiteralControl
      text = New LiteralControl("<h5>Composite Controls</h5>")
      Controls.Add(text)
    End Sub 
  End Class 

End Namespace

설명

이 클래스는 자식 컨트롤을 허용하지 않는 사용자 지정 컨트롤을 정의하려는 경우에 사용됩니다.

생성자

Name Description
EmptyControlCollection(Control)

EmptyControlCollection 클래스의 새 인스턴스를 초기화합니다.

속성

Name Description
Count

지정된 ASP.NET 서버 컨트롤에 ControlCollection 대한 개체의 서버 컨트롤 수를 가져옵니다.

(다음에서 상속됨 ControlCollection)
IsReadOnly

개체가 읽기 전용인지 여부를 ControlCollection 나타내는 값을 가져옵니다.

(다음에서 상속됨 ControlCollection)
IsSynchronized

개체가 동기화되는지 여부를 ControlCollection 나타내는 값을 가져옵니다.

(다음에서 상속됨 ControlCollection)
Item[Int32]

개체의 지정된 인덱스 위치에 있는 서버 컨트롤에 대한 참조를 ControlCollection 가져옵니다.

(다음에서 상속됨 ControlCollection)
Owner

개체가 속한 ASP.NET 서버 컨트롤을 ControlCollection 가져옵니다.

(다음에서 상속됨 ControlCollection)
SyncRoot

컨트롤 컬렉션에 대한 액세스를 동기화하는 데 사용할 수 있는 개체를 가져옵니다.

(다음에서 상속됨 ControlCollection)

메서드

Name Description
Add(Control)

컬렉션에 지정된 Control 개체의 추가를 거부합니다.

AddAt(Int32, Control)

지정된 인덱스 위치에서 지정된 Control 개체를 컬렉션에 추가하는 것을 거부합니다.

Clear()

현재 서버 컨트롤의 ControlCollection 개체에서 모든 컨트롤을 제거합니다.

(다음에서 상속됨 ControlCollection)
Contains(Control)

지정된 서버 컨트롤이 부모 서버 컨트롤의 ControlCollection 개체에 있는지 여부를 확인합니다.

(다음에서 상속됨 ControlCollection)
CopyTo(Array, Int32)

개체에 저장된 ControlCollection 자식 컨트롤을 개체의 Array 지정된 인덱스 위치에서 시작하여 개체에 Array복사합니다.

(다음에서 상속됨 ControlCollection)
Equals(Object)

지정된 개체가 현재 개체와 같은지 여부를 확인합니다.

(다음에서 상속됨 Object)
GetEnumerator()

개체를 반복 ControlCollection 할 수 있는 열거자를 검색합니다.

(다음에서 상속됨 ControlCollection)
GetHashCode()

기본 해시 함수로 사용됩니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
IndexOf(Control)

컬렉션에서 지정된 Control 개체의 인덱스를 검색합니다.

(다음에서 상속됨 ControlCollection)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
Remove(Control)

부모 서버 컨트롤의 개체에서 지정된 서버 컨트롤 ControlCollection 을 제거합니다.

(다음에서 상속됨 ControlCollection)
RemoveAt(Int32)

개체에서 지정된 인덱스 위치에 있는 자식 컨트롤을 ControlCollection 제거합니다.

(다음에서 상속됨 ControlCollection)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

확장명 메서드

Name Description
AsParallel(IEnumerable)

쿼리의 병렬 처리를 사용하도록 설정합니다.

AsQueryable(IEnumerable)

IEnumerable IQueryable변환합니다.

Cast<TResult>(IEnumerable)

IEnumerable 요소를 지정된 형식으로 캐스팅합니다.

OfType<TResult>(IEnumerable)

지정된 형식에 따라 IEnumerable 요소를 필터링합니다.

적용 대상