Table of Contents

Class JsonConsole

Namespace
TypedRest.CommandLine.IO
Assembly
TypedRest.CommandLine.dll

Reads from and writes to the default system console (stdin/stdout/stderr) using JSON serialization for objects.

public class JsonConsole : IConsole
Inheritance
JsonConsole
Implements
Inherited Members

Methods

Read(string)

Reads a text input.

public string Read(string prompt)

Parameters

prompt string

The prompt to ask the user.

Returns

string

ReadSecret(string)

Reads a secret text input.

public string ReadSecret(string prompt)

Parameters

prompt string

The prompt to ask the user.

Returns

string

Read<T>()

Reads an input object (usually in JSON format).

public T? Read<T>()

Returns

T

Type Parameters

T

The type of object to read.

Write(object?)

Writes an output object (usually in JSON format).

public void Write(object? output)

Parameters

output object

WriteError(Exception)

Writes an exception as an error message.

public void WriteError(Exception exception)

Parameters

exception Exception

WriteError(string)

Writes an error message.

public void WriteError(string output)

Parameters

output string