Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct Microsoft.​Extensions.​Primitives.​StringValues

Assembly: Microsoft.Extensions.Primitives

Implemented Interfaces

Represents zero/null, one, or many strings in an efficient way.

Fields and Constants

public static readonly StringValues
Empty
A readonly instance of the <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> struct whose value is an empty string array.
Remarks In application code, this field is most commonly used to safely represent a <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> that has null string values.

Properties

public int
Count
Gets the number of <see cref="T:System.String" /> elements contained in this <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> .
public string
Item

Methods

public static StringValues
Concat​(StringValues values1, StringValues values2)
Concatenates two specified instances of <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> .
Returns The concatenation of <paramref name="values1" /> and <paramref name="values2" /> .
values1 The first <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> to concatenate.
values2 The second <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> to concatenate.
public static StringValues
Concat​(StringValues& values, string value)
public static StringValues
Concat​(string value, StringValues& values)
public bool
Equals​(StringValues other)
Determines whether this instance and another specified <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> object have the same values.
Returns <see langword="true" /> if the value of <paramref name="other" /> is the same as the value of this instance; otherwise, <see langword="false" /> .
other The string to compare to this instance.
public static bool
Equals​(StringValues left, StringValues right)
Determines whether two specified <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> objects have the same values in the same order.
Returns <see langword="true" /> if the value of <paramref name="left" /> is the same as the value of <paramref name="right" /> ; otherwise, <see langword="false" /> .
left The first <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> to compare.
right The second <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> to compare.
public static bool
Equals​(StringValues left, string right)
Determines whether the specified <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> and <see cref="T:System.String" /> objects have the same values.
Returns <see langword="true" /> if the value of <paramref name="left" /> is the same as the value of <paramref name="right" /> ; otherwise, <see langword="false" /> . If <paramref name="right" /> is <see langword="null" /> , the method returns <see langword="false" /> .
left The <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> to compare.
right The <see cref="T:System.String" /> to compare.
public static bool
Equals​(StringValues left, string[] right)
Determines whether the specified <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> and string array objects have the same values.
Returns <see langword="true" /> if the value of <paramref name="left" /> is the same as the value of <paramref name="right" /> ; otherwise, <see langword="false" /> .
left The <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> to compare.
right The string array to compare.
public bool
Equals​(object obj)
Determines whether this instance and a specified object have the same value.
Returns <see langword="true" /> if the current object is equal to <paramref name="obj" /> ; otherwise, <see langword="false" /> .
obj An object to compare with this object.
public bool
Equals​(string other)
Determines whether this instance and a specified <see cref="T:System.String" /> , have the same value.
Returns <see langword="true" /> if the value of <paramref name="other" /> is the same as this instance; otherwise, <see langword="false" /> . If <paramref name="other" /> is <see langword="null" /> , returns <see langword="false" /> .
other The <see cref="T:System.String" /> to compare to this instance.
public static bool
Equals​(string left, StringValues right)
Determines whether the specified <see cref="T:System.String" /> and <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> objects have the same values.
Returns <see langword="true" /> if the value of <paramref name="left" /> is the same as the value of <paramref name="right" /> ; otherwise, <see langword="false" /> . If <paramref name="left" /> is <see langword="null" /> , the method returns <see langword="false" /> .
left The <see cref="T:System.String" /> to compare.
right The <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> to compare.
public bool
Equals​(string[] other)
Determines whether this instance and a specified string array have the same values.
Returns <see langword="true" /> if the value of <paramref name="other" /> is the same as this instance; otherwise, <see langword="false" /> .
other The string array to compare to this instance.
public static bool
Equals​(string[] left, StringValues right)
Determines whether the specified string array and <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> objects have the same values.
Returns <see langword="true" /> if the value of <paramref name="left" /> is the same as the value of <paramref name="right" /> ; otherwise, <see langword="false" /> .
left The string array to compare.
right The <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> to compare.
public Enumerator
GetEnumerator​()
Retrieves an object that can iterate through the individual strings in this <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> .
Returns An enumerator that can be used to iterate through the <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> .
public int
GetHashCode​()
Returns a hash code for this instance.
Returns A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
public static bool
IsNullOrEmpty​(StringValues value)
Indicates whether the specified <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> contains no string values.
Returns <see langword="true" /> if <paramref name="value" /> contains a single <see langword="null" /> or empty string or an empty array; otherwise, <see langword="false" /> .
value The <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> to test.
public string[]
ToArray​()
Creates a string array from the current <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> object.
Returns A string array represented by this instance.
Remarks <para>If the <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> contains a single string internally, it is copied to a new array.</para> <para>If the <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> contains an array internally it returns that array instance.</para>
public string
ToString​()
Converts the value of the current <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> object to its equivalent string representation, with multiple values joined as a comma separated string.
Returns A string representation of the value of the current <see cref="T:Microsoft.Extensions.Primitives.StringValues" /> object.
protected void
Finalize​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object