C# make it work for value types

Gate does not work (compile).

Also we miss an Optional<T> type for C#.