Class Question
A TypeSafe question identified by its type field.
public abstract class Question
- Inheritance
-
Question
- Derived
- Inherited Members
Properties
Instructions
The question as text, a JSON object, or an array. Omitted when the builder was not given
instructions (except Noul(object?, NoulCriteria?), which defaults to null).
public object? Instructions { get; }
Property Value
Type
Question type: noul, choice, or score.
public abstract string Type { get; }
Property Value
Methods
Choice(object?, Dictionary<string, object?>)
Create a question that selects between named alternatives.
Mirrors JS choice().
public static ChoiceQuestion Choice(object? instructions, Dictionary<string, object?> criteria)
Parameters
instructionsobjectThe question as text, a JSON object or array, or
null.criteriaDictionary<string, object>Labels mapped to descriptions, or
nullfor undescribed labels.
Returns
Choice(object?, IReadOnlyDictionary<string, object?>)
Create a question that selects between named alternatives.
Mirrors JS choice().
public static ChoiceQuestion Choice(object? instructions, IReadOnlyDictionary<string, object?> criteria)
Parameters
instructionsobjectThe question as text, a JSON object or array, or
null.criteriaIReadOnlyDictionary<string, object>Labels mapped to descriptions, or
nullfor undescribed labels.
Returns
Choice(object?, params (string Label, object? Description)[])
Create a question that selects between named alternatives, from label/description pairs. Duplicate labels throw. Pass a dictionary when you already have a map.
public static ChoiceQuestion Choice(object? instructions, params (string Label, object? Description)[] criteria)
Parameters
instructionsobjectcriteria(string Label, object Description)[]
Returns
Map(params (string Name, Question Question)[])
Build a name → question map from labeled pairs. Duplicate names throw.
Use this when you need a dictionary (for example Questions,
or a model / cancellation token on the dictionary SystemOneAsync overload).
public static Dictionary<string, Question> Map(params (string Name, Question Question)[] questions)
Parameters
Returns
Noul(object?, NoulCriteria?)
Create a yes/no question with optional descriptions for either outcome.
Mirrors JS noul().
public static NoulQuestion Noul(object? instructions = null, NoulCriteria? criteria = null)
Parameters
instructionsobjectThe question as text, a JSON object or array; defaults to
null.criteriaNoulCriteriaOptional descriptions of the yes and no outcomes.
Returns
Noul(object?, NoulCriteria?, bool)
Create a yes/no question, including an explicit null criteria value on the wire.
public static NoulQuestion Noul(object? instructions, NoulCriteria? criteria, bool includeCriteria)
Parameters
instructionsobjectcriteriaNoulCriteriaincludeCriteriabool
Returns
Score(object?, IReadOnlyList<object?>)
Create a score question using an ordered rubric.
Mirrors JS score().
public static ScoreQuestion Score(object? instructions, IReadOnlyList<object?> criteria)
Parameters
instructionsobjectThe question as text, a JSON object or array, or
null.criteriaIReadOnlyList<object>At least two descriptions indexed by score from zero; entries may be
null.
Returns
Score(object?, params object?[])
Create a score question using an ordered rubric.
Mirrors JS score().
public static ScoreQuestion Score(object? instructions, params object?[] criteria)
Parameters
instructionsobjectThe question as text, a JSON object or array, or
null.criteriaobject[]At least two descriptions indexed by score from zero; entries may be
null.
Returns
Validate(IReadOnlyDictionary<string, Question>)
Reject empty question sets and score questions without a list of at least two criteria.
public static void Validate(IReadOnlyDictionary<string, Question> questions)
Parameters
questionsIReadOnlyDictionary<string, Question>