Flush() public method

Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
public Flush ( ) : void
return void
Ejemplo n.º 1
0
    public string Serialize <T>(T value)
    {
        var writer = new StringWriter();
        var uson   = new UsonWriter(writer);

        uson.DefaultProperty = defaultPropertyMap.GetOrAdd(typeof(T), key =>
        {
            return(typeof(T)
                   .GetCustomAttributes(true)
                   .OfType <DefaultPropertyAttribute>()
                   .Select(x => x.Name)
                   .FirstOrDefault() ?? "");
        });

        this.serializer.Serialize(uson, value);

        uson.Flush();

        return(writer.ToString());
    }