System.Runtime.Serialization.ObjectManager.GetDeserializationConstructor C# (CSharp) Method

GetDeserializationConstructor() static private method

static private GetDeserializationConstructor ( Type t ) : ConstructorInfo
t System.Type
return System.Reflection.ConstructorInfo
        internal static ConstructorInfo GetDeserializationConstructor(Type t)
        {
            // TODO #10530: Use Type.GetConstructor that takes BindingFlags when it's available
            foreach (ConstructorInfo ci in t.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly))
            {
                ParameterInfo[] parameters = ci.GetParameters();
                if (parameters.Length == 2 &&
                    parameters[0].ParameterType == typeof(SerializationInfo) &&
                    parameters[1].ParameterType == typeof(StreamingContext))
                {
                    return ci;
                }
            }

            throw new SerializationException(SR.Format(SR.Serialization_ConstructorNotFound, t.FullName));
        }