public T Leer(string path) { try { if (this.tipo == IArchivos <T> .ETipoArchivo.XML) { if (Path.GetExtension(path) == ".xml") { using (XmlTextReader xmlTextReader = new XmlTextReader(path)) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); return((T)xmlSerializer.Deserialize(xmlTextReader)); } } else { throw new ExtensionInvalidaException("Extension Invalida para XML"); } } else { if (Path.GetExtension(path) == ".json") { ArchivoTexto archivoTexto = new ArchivoTexto(); string texto = archivoTexto.Leer(path); return(JsonSerializer.Deserialize <T>(texto)); } else { throw new ExtensionInvalidaException("Extension Invalida para JSON"); } } } catch (Exception) { throw; } }