Прочетете на английски Редактиране

Споделяне чрез


WebResponse Constructors

Definition

Initializes a new instance of the WebResponse class.

Overloads

WebResponse()

Initializes a new instance of the WebResponse class.

WebResponse(SerializationInfo, StreamingContext)
Obsolete.

Initializes a new instance of the WebResponse class from the specified instances of the SerializationInfo and StreamingContext classes.

WebResponse()

Source:
WebResponse.cs
Source:
WebResponse.cs
Source:
WebResponse.cs

Initializes a new instance of the WebResponse class.

C#
protected WebResponse();

Remarks

Applications do not call the WebResponse constructor directly; use the GetResponse method on a WebRequest instance.

Notes to Inheritors

This constructor creates and initializes the required fields for descendant classes.

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

WebResponse(SerializationInfo, StreamingContext)

Source:
WebResponse.cs
Source:
WebResponse.cs
Source:
WebResponse.cs

Caution

Serialization has been deprecated for WebResponse.

Initializes a new instance of the WebResponse class from the specified instances of the SerializationInfo and StreamingContext classes.

C#
[System.Obsolete("Serialization has been deprecated for WebResponse.")]
protected WebResponse(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
C#
protected WebResponse(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);

Parameters

serializationInfo
SerializationInfo

An instance of the SerializationInfo class that contains the information required to serialize the new WebRequest instance.

streamingContext
StreamingContext

An instance of the StreamingContext class that indicates the source of the serialized stream that is associated with the new WebRequest instance.

Attributes

Exceptions

Any attempt is made to access the constructor, when the constructor is not overridden in a descendant class.

Remarks

When implemented by a descendant class, this constructor implements the ISerializable interface for the WebResponse descendant.

Applies to

.NET 10 и други версии
Продукт Версии (остаряло)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6 (7, 8, 9, 10)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1