System.Xml.Serialization.TempAssembly.IsSerializerVersionMatch C# (CSharp) Method

IsSerializerVersionMatch() static private method

static private IsSerializerVersionMatch ( Assembly serializer, Type type, string defaultNamespace, string location ) : bool
serializer System.Reflection.Assembly
type System.Type
defaultNamespace string
location string
return bool
        static bool IsSerializerVersionMatch(Assembly serializer, Type type, string defaultNamespace, string location) {
            if (serializer == null)
                return false;
            object[] attrs = serializer.GetCustomAttributes(typeof(XmlSerializerVersionAttribute), false);
            if (attrs.Length != 1)
                return false;

            XmlSerializerVersionAttribute assemblyInfo = (XmlSerializerVersionAttribute)attrs[0];
            if (assemblyInfo.ParentAssemblyId == GenerateAssemblyId(type) && assemblyInfo.Namespace == defaultNamespace)
                return true;
            return false;
        }
        static string GenerateAssemblyId(Type type) {