I'm creating a PowerShell Cmdlet in C# to read fields from a JSON file and output some objects. The objects are a simple POCO type:
public class FieldDefinition
{
public FieldDefinition(string name, TypeCode code)
{
Name = name;
Code = code;
}
public string Name { get; }
public TypeCode Code { get; }
}
When writing the output, the entries are presented as:
PS ~Debug> Get-Field
Name : Session
Code : Int64
Name : Instance
Code : String
Ideally, I want the default presentation to be as a table:
PS ~Debug> Get-Field | Format-Table
Name Code
---- ----
Session Int64
Instance String
When I call commands like Get-Process, I am always presented with the table format. How can I make my command present its output as a table?