Queue.TrimToSize 메서드

정의

용량을 Queue의 실제 요소 수로 설정합니다.Sets the capacity to the actual number of elements in the Queue.

public:
 virtual void TrimToSize();
public virtual void TrimToSize ();
abstract member TrimToSize : unit -> unit
override this.TrimToSize : unit -> unit
Public Overridable Sub TrimToSize ()

예외

Queue이 읽기 전용인 경우The Queue is read-only.

설명

이 메서드는 큐에 새 요소가 추가 될 경우 큐의 메모리 오버 헤드를 최소화할 데 사용할 수 있습니다.This method can be used to minimize a queue's memory overhead if no new elements will be added to the queue.

Queue를 초기 상태로 다시 설정 하려면 TrimToSize를 호출 하기 전에 Clear 메서드를 호출 합니다.To reset a Queue to its initial state, call the Clear method before calling TrimToSize. Queue을 잘라서 Queue의 용량을 기본 용량으로 설정 합니다.Trimming an empty Queue sets the capacity of the Queue to the default capacity.

이 메서드는 n Count되는 O(n) 작업입니다.This method is an O(n) operation, where n is Count.

적용 대상

추가 정보