public static IFileManager GetFile(string exstension) { IFileManager file; switch (exstension) { case ".txt": file = new TextFile(); break; case ".bin": file = new BinaryFile(); break; case ".xml": file = new XmlFIle(); break; default: throw new NotSupportedException("Файл данного типа не поддерживается"); } return(file); }
public static IFileManager GetFile(string exstension) { IFileManager file; switch (exstension) { case ".txt": file = new TextFile(); break; case ".bin": file = new BinaryFile(); break; case ".xml": file = new XmlFIle(); break; default: throw new Exception("Неверно указано имя файла"); } return(file); }