ISessionStateItemCollection.RemoveAt(Int32) 메서드

정의

지정된 인덱스에 있는 항목을 컬렉션에서 삭제합니다.

public:
 void RemoveAt(int index);
public void RemoveAt (int index);
abstract member RemoveAt : int -> unit
Public Sub RemoveAt (index As Integer)

매개 변수

index
Int32

컬렉션에서 제거할 항목의 인덱스입니다.

예제

다음 코드 예제에서는 RemoveAt 메서드를 구현하는 방법을 보여 줍니다. 인터페이스의 전체 구현 ISessionStateItemCollection 예제는 인터페이스 개요에 제공된 예제를 ISessionStateItemCollection 참조하세요.

public void RemoveAt(int index)
{
  if (index < 0 || index >= this.Count)
    throw new ArgumentOutOfRangeException("The specified index is not within the acceptable range.");

  pItems.RemoveAt(index);
  pDirty = true;
}
 Public Sub RemoveAt(index As Integer) Implements ISessionStateItemCollection.RemoveAt 
   If index < 0 OrElse index >= Me.Count Then _
     Throw New ArgumentOutOfRangeException("The specified index is not within the acceptable range.")

   pItems.RemoveAt(index)
   pDirty = True
 End Sub

설명

메서드를 RemoveAt 구현할 때 구현의 값 ISessionStateItemCollectionDirty 수정되었음을 나타내도록 true 속성을 설정해야 합니다.

메서드 구현이 RemoveAt 0보다 작거나 같거나 보다 ICollection.Count큰 경우 index 예외를 throw ArgumentOutOfRangeException 해야 합니다.

적용 대상

추가 정보