Class FormBody

Assembly: redb.Route.dll

The fields of an application/x-www-form-urlencoded body, in order. A name may repeat (checkboxes, a list
field), so the form is a list of pairs; answers the first value of a name and
every one. Names compare ordinally, as HTML forms send them.

public sealed class FormBody : IReadOnlyList<KeyValuePair<string, string>>, IReadOnlyCollection<KeyValuePair<string, string>>, IEnumerable<KeyValuePair<string, string>>, IEnumerable, ICloneable

Inheritance

Object→FormBody

Implements

Properties

Count

Gets the number of elements in the collection.

public int Count { get; }

this[int]

Gets the element at the specified index in the read-only list.

public KeyValuePair<string, string> this[int index] { get; }

Methods

Add(string, string)

Appends a field; a field with the same name may already be there.

public FormBody Add(string name, string value)

Clone()

A copy with its own field list (names and values are immutable strings).

public object Clone()

Contains(string)

Whether the form has a field named name.

public bool Contains(string name)

Get(string)

The first value of name, or null.

public string? Get(string name)

GetAll(string)

Every value of name, in order; empty when the field is absent.

public IReadOnlyList<string> GetAll(string name)

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<KeyValuePair<string, string>> GetEnumerator()

ToDictionary()

The fields as a dictionary of the first value of each name (later repeats are left out).

public Dictionary<string, string> ToDictionary()

ToString()

The form in its wire form, UTF-8 (for logs and tests).

public override string ToString()

Constructors

FormBody()

An empty form.

FormBody(IEnumerable<KeyValuePair<string, string>>)

A form with the given fields, in order.