ExporterExtensions.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <copyright file="ExporterExtensions.cs" company="OxyPlot">
  3. // Copyright (c) 2014 OxyPlot contributors
  4. // </copyright>
  5. // <summary>
  6. // Provides extension methods for exporters.
  7. // </summary>
  8. // --------------------------------------------------------------------------------------------------------------------
  9. namespace OxyPlot.Wpf
  10. {
  11. using System.IO;
  12. /// <summary>
  13. /// Provides extension methods for exporters.
  14. /// </summary>
  15. public static class ExporterExtensions
  16. {
  17. /// <summary>
  18. /// Exports the specified <see cref="PlotModel" /> to a file.
  19. /// </summary>
  20. /// <param name="exporter">The exporter.</param>
  21. /// <param name="model">The model to export.</param>
  22. /// <param name="path">The path to the file.</param>
  23. public static void ExportToFile(this IExporter exporter, IPlotModel model, string path)
  24. {
  25. using var stream = File.OpenWrite(path);
  26. exporter.Export(model, stream);
  27. }
  28. }
  29. }