Ejemplo n.º 1
0
        public void Serialize(Stream stream, object @object, Type objectType)
        {
            if (@object == null)
            {
                return;
            }

            using (var valueWriter = _valueWriterFactory.Create(stream))
            {
                var serializer = new ValueContainerSerializer(_decomposerSelector, _typeSerializerHelper);
                serializer.Serialize(@object, valueWriter);
            }
        }
        public void Serialize(TextWriter writer, object @object)
        {
            if (@object == null)
            {
                return;
            }

            using (var valueWriter = _valueTextWriterFactory.Create(writer))
            {
                var serializer = new ValueContainerSerializer(_decomposerSelector, _typeSerializerHelper);
                serializer.Serialize(@object, valueWriter);
            }
        }
        public void Serialize(Stream stream, object @object)
        {
            if (@object == null)
            {
                return;
            }

            using (var textWriter = new StreamWriter(stream, UTF8, 4096, leaveOpen: true))
            {
                using (var valueWriter = _valueTextWriterFactory.Create(textWriter))
                {
                    var serializer = new ValueContainerSerializer(_decomposerSelector, _typeSerializerHelper);
                    serializer.Serialize(@object, valueWriter);
                }
            }
        }
Ejemplo n.º 4
0
        public void Serialize(Stream stream, object @object)
        {
            if (@object == null)
            {
                return;
            }

            using (var valueWriter = _valueWriterFactory.Create(stream))
            {
                var serializer = new ValueContainerSerializer(
                    _decomposerSelector,
                    _typeNameShortener,
                    _assemblyNameShortener);

                serializer.Serialize(@object, valueWriter);
            }
        }