While Wyam is certainly still usable, it's been rebranded and rebooted as Statiq with a ton of improvements. You almost certainly want to look there unless you're already a Wyam user.

Switch Class


Executes sequences of modules depending on whether the input document contains a specified value.
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IModule"] click Interface0 "/api/Wyam.Common.Modules/IModule" Type["Switch"] class Type type-node


public class Switch : IModule


When creating a Switch module you specify a delegate that will get an object for each document. Cases are then defined via fluent methods that compare the returned object for each document against a supplied object (or array). If the defined object or any of the objects in the array for the case equal the one for the document, the modules in the case are executed. The output of the module is the aggregate output of executing the specified modules against documents matching each case. If a document document match a case, it is output against the default case (if defined) or output without modification (if no default is defined).


Name Summary
Switch(DocumentConfig) Defines the delegate that will be invoked against each input document to get the case comparison value.


Name Value Summary
Case(Object, IModule[]) Switch
Defines a case.
Default(IModule[]) Switch
Defines modules to execute against documents that don't match a case.
Execute(IReadOnlyList<IDocument>, IExecutionContext) IEnumerable<IDocument>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.