Esempio n. 1
0
            void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context)
            {
                using var stream = new MemoryStream();
                Save(stream);

                si.AddValue("Data", stream.ToArray());

                if (PropertyBagBinary != null)
                {
                    try
                    {
                        using var propertyBagBinaryStream = new MemoryStream();
                        PropertyBagBinary.Write(propertyBagBinaryStream);
                        si.AddValue(nameof(PropertyBagBinary), propertyBagBinaryStream.ToArray());
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "Failed to serialize the property bag into ResX : " + e.ToString());
                    }
                }
            }