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

설명

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

생성자

EmptyControlCollection(Control)

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

속성

Count

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

(다음에서 상속됨 ControlCollection)
IsReadOnly

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

(다음에서 상속됨 ControlCollection)
IsSynchronized

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

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

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

(다음에서 상속됨 ControlCollection)
Owner

ControlCollection 개체가 들어 있는 ASP.NET 서버 컨트롤을 가져옵니다.

(다음에서 상속됨 ControlCollection)
SyncRoot

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

(다음에서 상속됨 ControlCollection)

메서드

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)

확장 메서드

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable)

쿼리를 병렬화할 수 있도록 합니다.

AsQueryable(IEnumerable)

IEnumerableIQueryable로 변환합니다.

적용 대상