public object Deserialize(XNode data, Type type)
        {
            XElement element = data as XElement;

            if (element != null)
            {
                INamedSerializer serializer = null;
                if (this.namedSerializer.TryGetValue(element.Name.LocalName, out serializer))
                {
                    return(serializer.Deserialize(data, type));
                }
            }
            Type serializerType = type.IsGenericType ? type.GetGenericTypeDefinition() : type;

            return(this.typedSerializer[serializerType].Deserialize(data, type));
        }
 public void AddSerializer(INamedSerializer serializer)
 {
     this.namedSerializer[serializer.ElementName] = serializer;
     this.typedSerializer[serializer.TargetType]  = serializer;
 }