CookieContainer 构造函数

定义

初始化 CookieContainer 类的新实例。Initializes a new instance of the CookieContainer class.

重载

CookieContainer()

初始化 CookieContainer 类的新实例。Initializes a new instance of the CookieContainer class.

CookieContainer(Int32)

使用指定的表示容器可以包含的 CookieContainer 实例数的值初始化 Cookie 类的新实例。Initializes a new instance of the CookieContainer class with a specified value for the number of Cookie instances that the container can hold.

CookieContainer(Int32, Int32, Int32)

使用指定属性初始化 CookieContainer 类的新实例。Initializes a new instance of the CookieContainer class with specific properties.

CookieContainer()

初始化 CookieContainer 类的新实例。Initializes a new instance of the CookieContainer class.

public:
 CookieContainer();
public CookieContainer ();
Public Sub New ()

注解

无参数构造函数将所有字段初始化为其默认值。The parameterless constructor initializes all fields to their default values. DefaultCookieLimit 用于初始化 CapacityDefaultCookieLengthLimit 用于 MaxCookieSizeDefaultPerDomainCookieLimit 用于 PerDomainCapacityDefaultCookieLimit is used to initialize Capacity, DefaultCookieLengthLimit is used for MaxCookieSize, and DefaultPerDomainCookieLimit is used for PerDomainCapacity.

另请参阅

CookieContainer(Int32)

使用指定的表示容器可以包含的 CookieContainer 实例数的值初始化 Cookie 类的新实例。Initializes a new instance of the CookieContainer class with a specified value for the number of Cookie instances that the container can hold.

public:
 CookieContainer(int capacity);
public CookieContainer (int capacity);
new System.Net.CookieContainer : int -> System.Net.CookieContainer
Public Sub New (capacity As Integer)

参数

capacity
Int32

Cookie 可以包含的 CookieContainer 实例数。The number of Cookie instances that the CookieContainer can hold.

异常

capacity 小于或等于零。capacity is less than or equal to zero.

注解

PerDomainCapacity 初始化为20,MaxCookieSize 初始化为4096。PerDomainCapacity is initialized to 20, and MaxCookieSize is initialized to 4096.

另请参阅

CookieContainer(Int32, Int32, Int32)

使用指定属性初始化 CookieContainer 类的新实例。Initializes a new instance of the CookieContainer class with specific properties.

public:
 CookieContainer(int capacity, int perDomainCapacity, int maxCookieSize);
public CookieContainer (int capacity, int perDomainCapacity, int maxCookieSize);
new System.Net.CookieContainer : int * int * int -> System.Net.CookieContainer
Public Sub New (capacity As Integer, perDomainCapacity As Integer, maxCookieSize As Integer)

参数

capacity
Int32

Cookie 可以包含的 CookieContainer 实例数。The number of Cookie instances that the CookieContainer can hold.

perDomainCapacity
Int32

每个域的 Cookie 实例数。The number of Cookie instances per domain.

maxCookieSize
Int32

Cookie 中任何单个 CookieContainer 的最大大小(以字节为单位)。The maximum size in bytes for any single Cookie in a CookieContainer.

异常

perDomainCapacity 不等于 MaxValueperDomainCapacity is not equal to MaxValue.

andand (perDomainCapacity 小于或等于零,或者 perDomainCapacity 大于 capacity)(perDomainCapacity is less than or equal to zero or perDomainCapacity is greater than capacity).

maxCookieSize 小于或等于零。maxCookieSize is less than or equal to zero.

注解

参数指定 CapacityMaxCookieSizePerDomainCapacity的值。The parameters specify values for Capacity, MaxCookieSize, and PerDomainCapacity.

另请参阅

适用于