using System; using System.Collections.Generic; using System.Linq; using System.Text; using NUnit.Framework; using ChemAxon.NET.API.IO; using ChemAxon.NET.API; using ChemAxon.NET.IKVM.Chemistry; namespace ChemAxon.NET.UnitTest.API.Examples.IO.File { class FileExample { public void ReadFromFile_Example() { IFileHandler fileHandler = MainFactory.IO.OpenFile(@"molecules.mrv"); IEnumerable<IJChemMolecule> molecules = fileHandler.Read(); foreach (IJChemMolecule molecule in molecules) Console.WriteLine(molecule.Formula); } public void WriteToFile_Example() { IFileHandler fileHandler = MainFactory.IO.OpenFile(@"molecules.mrv"); var newMolecules = new List<IJChemMolecule>(); newMolecules.Add(MainFactory.Chemistry.CreateMolecule("benzene")); newMolecules.Add(MainFactory.Chemistry.CreateMolecule("methylpropane")); newMolecules.Add(MainFactory.Chemistry.CreateMolecule("hexane")); fileHandler.Write(newMolecules); } } }