internal void InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SerializationBinder binder)
{
_objectType = objectType;
_context = context;
_serObjectInfoInit = serObjectInfoInit;
if (objectType.IsArray)
{
InitNoMembers();
return;
}
InvokeSerializationBinder(binder);
ISurrogateSelector surrogateSelectorTemp = null;
if (surrogateSelector != null)
{
_serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out surrogateSelectorTemp);
}
if (_serializationSurrogate != null)
{
// surrogate does not have this problem since user has pass in through the BF's ctor
_si = new SerializationInfo(objectType, converter);
_cache = new SerObjectInfoCache(objectType);
_isSi = true;
}
else if (!ReferenceEquals(objectType, Converter.s_typeofObject) && Converter.s_typeofISerializable.IsAssignableFrom(objectType))
{
_si = new SerializationInfo(objectType, converter);
_cache = new SerObjectInfoCache(objectType);
CheckTypeForwardedFrom(_cache, objectType, _binderAssemblyString);
_isSi = true;
}
if (!_isSi)
{
InitMemberInfo();
CheckTypeForwardedFrom(_cache, objectType, _binderAssemblyString);
}
}