อ่านในภาษาอังกฤษ แก้ไข

แชร์ผ่าน


CollectionsMarshal.SetCount<T>(List<T>, Int32) Method

Definition

Sets the count of the List<T> to the specified value.

C#
public static void SetCount<T>(System.Collections.Generic.List<T> list, int count);

Type Parameters

T

The type of the elements in the list.

Parameters

list
List<T>

The list to set the count of.

count
Int32

The value to set the list's count to.

Exceptions

list is null.

count is negative.

Remarks

When increasing the count, uninitialized data is being exposed.

Applies to

ผลิตภัณฑ์ เวอร์ชัน
.NET 8, 9, 10