EntityTagHeaderValue Class

Namespace: System.Net.Http.Headers

Represents an Entity-Tag header value. The Entity-Tag header is used to identify a specific version of a resource. It is an opaque identifier and can be used to determine if a cached copy of a resource is the same as the current version of the resource.

Constructors

public EntityTagHeaderValue(string tag)
Initializes a new instance of the EntityTagHeaderValue class with a specified tag.
Parameters:
tag - The entity tag string.
public EntityTagHeaderValue(string tag, bool isWeak)
Initializes a new instance of the EntityTagHeaderValue class with a specified tag and a value indicating whether the tag is weak.
Parameters:
tag - The entity tag string.
isWeak - true if the entity tag is a weak ETag; otherwise, false.

Properties

public string Tag { get; }
Gets the entity tag string.
public bool IsWeak { get; }
Gets a value indicating whether the entity tag is a weak ETag.

Methods

public static EntityTagHeaderValue Parse(string input)
Parses an entity tag header value from a string.
Parameters:
input - The string to parse.
Returns:
A EntityTagHeaderValue instance.
public static bool TryParse(string input, [outEntityTagHeaderValue ref value)
Tries to parse an entity tag header value from a string.
Parameters:
input - The string to parse.
value - When this method returns, contains the parsed EntityTagHeaderValue instance, if the parse succeeded, or null otherwise.
Returns:
true if the string was parsed successfully; otherwise, false.
public string ToString()
Returns a string representation of the entity tag header value.
Returns:
A string representation of the entity tag header value.

Operators

public static bool Equals(EntityTagHeaderValue a, EntityTagHeaderValue b)
Compares two EntityTagHeaderValue objects for equality.
public static bool operator==(EntityTagHeaderValue a, EntityTagHeaderValue b)
Compares two EntityTagHeaderValue objects for equality using the equality operator.
public static bool operator!=(EntityTagHeaderValue a, EntityTagHeaderValue b)
Compares two EntityTagHeaderValue objects for inequality using the inequality operator.