DoubleListParameterValue
DoubleListParameterValue
DoubleListParameterValue holds a list of numbers for one query parameter, in the Contentstack.Management.Core.Queryable namespace.
When to Use This Class: Create it yourself only to replace a value through the indexer of a ParameterCollection. The matching Add overload of ParameterCollection creates it for you.
Conceptual Role: Acts as a typed value in a ParameterCollection. It extends the empty base class QueryParamValue.
Returns: DoubleListParameterValue. A query parameter value.
Class-Level Properties
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| Value | List<double> | Yes | Not applicable | Number values of the array parameter. |
Class-Level Notes
How the SDK writes it.
- The SDK writes one name[]=<number> pair per item, sorted in ascending order, with the invariant number format, so 1.5 stays 1.5 in every culture.
- The SDK sorts Value in place when it writes the query string, so the order of the list you passed changes.
Method Index
| Method Name | Returns | Description |
|---|---|---|
| DoubleListParameterValue | A new parameter value. | Creates the value object. |
Class-Level Snippet
This snippet replaces a query parameter value through the indexer, then prints the pair the SDK sends.
using System;
using System.Collections.Generic;
using System.Text.Json.Nodes;
using Contentstack.Management.Core.Queryable;
ParameterCollection collection = new ParameterCollection();
collection["<PARAMETER_NAME>"] = new DoubleListParameterValue(new List<double> { 2, 1 });
foreach (KeyValuePair<string, string> pair in collection.GetSortedParametersList())
{
Console.WriteLine($"{pair.Key}={pair.Value}");
}Methods
Each method of the DoubleListParameterValue class has its own section below, with its parameters, validation rules, behavior, and examples.
DoubleListParameterValue
DoubleListParameterValue creates a value object that holds a list of numbers for one query parameter.
| Name | Type | Description |
|---|---|---|
| values (required) | List<double> | Number values of the array parameter. |
Returns: DoubleListParameterValue. A new parameter value.
Validation
- There is no client-side validation. The constructor stores values as given, and the SDK reads it when it builds the query string of a request.
- Throws NullReferenceException when the SDK writes the query string, if values is null.
Behavior
- Client-side only. The constructor sends no request.
- The SDK writes one name[]=<number> pair per item, sorted in ascending order, with the invariant number format, so 1.5 stays 1.5 in every culture.
- Add the object to a ParameterCollection with the Add(string key, QueryParamValue value) overload or the indexer.
Example
Basic usage: add the value to a collection
using System;
using System.Collections.Generic;
using System.Text.Json.Nodes;
using Contentstack.Management.Core.Queryable;
DoubleListParameterValue value = new DoubleListParameterValue(new List<double> { 2, 1 });
ParameterCollection collection = new ParameterCollection();
collection.Add("<PARAMETER_NAME>", value);
Console.WriteLine(collection.GetSortedParametersList().Count);