Customizability comes to type returned from an async method

In the same way it’s possible to await any type following a specific ‘trait’ (yes, we need them in C#), It’s now possible to return custom type from an async method: Return Any (Task-Like) Type From An Async Method | Bar Arnon. We can thanks corefx, Roslyn and Stephen Toub.

Advertisements

Building strongly typed application configuration utility with Roslyn

Awesome: Building strongly typed application configuration utility with Roslyn use Roselyn scripting engine to delegate to an external script filling a strongly typed instance.

The complete code is already very short but all is really made in only 3 lines :

  1. fill a ScriptOptions instance,
  2. creating a CSharpScript and
  3. running it asynchroniously.

For a production use, script error detection must be added and a way to add new references from script itself (and perhaps nuget references).

EDIT: I’ve neglected to follow a link about ConfigR: same needs but some step head. ConfigR use scriptcs on top of Roselyn to provide more possibilities: load sub script, add reference, use predefined packs (nuget packages but more script friendly using MEF) and debugging.