/// <summary>
 /// Create.
 /// </summary>
 /// <param name="stream">The stream to read or write.</param>
 /// <param name="formatter">The formatter holding the serialization properties.</param>
 public ObjectWriter(Stream stream, FastBinaryFormatter formatter)
     : base(stream, formatter)
 {
     this.typesToIDsDictionary   = new Dictionary <Type, int>();
     this.objectsToIDsDictionary = new Dictionary <Reference, int>();
     this.stringsToIDsDictionary = new Dictionary <string, int>();
     this.internFieldNames       = formatter.InternFieldNames;
 }
 /// <summary>
 /// Create.
 /// </summary>
 /// <param name="stream">The stream to read from.</param>
 /// <param name="formatter">The formatter holding the serialization properties.</param>
 public ObjectReader(Stream stream, FastBinaryFormatter formatter)
     : base(stream, formatter)
 {
     deserializationCallbacksList = new List <IDeserializationCallback>();
     idsToTypesList   = new List <Type>();
     idsToObjectsList = new List <object>();
     unusedObjectIDsDuringSurrogation   = new HashSet <int>();
     typesToDeserializationConstructors = new Dictionary <Type, ConstructorInfo>();
     typesToDefaultConstructors         = new Dictionary <Type, ConstructorInfo>();
     memberInfoOptionalityCache         = new Dictionary <MemberInfo, bool>();
     idsToStringsList = new List <string>();
 }
        /// <summary>
        /// Create.
        /// </summary>
        /// <param name="stream">The stream to read or write.</param>
        /// <param name="formatter">The formatter holding the serialization properties.</param>
        public ObjectStreamer(Stream stream, FastBinaryFormatter formatter)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (formatter == null)
            {
                throw new ArgumentNullException("formatter");
            }

            this.stream            = stream;
            this.binder            = formatter.Binder;
            this.context           = formatter.Context;
            this.surrogateSelector = formatter.SurrogateSelector;
            this.converter         = formatter.Converter;

            this.emptyParameters = new object[0];

            this.serializableMembersByType   = new Dictionary <Type, MemberInfo[]>();
            this.attributedMethodsDictionary = new Dictionary <AttributedMethodSearch, IList <MethodInfo> >();
            this.surrogatesByType            = new Dictionary <Type, ISerializationSurrogate>();
        }