Skip to content

Instantly share code, notes, and snippets.

@LoriBru
Created January 9, 2019 15:38
Show Gist options
  • Select an option

  • Save LoriBru/178eaeaea5037fac7f77c7c34ee83584 to your computer and use it in GitHub Desktop.

Select an option

Save LoriBru/178eaeaea5037fac7f77c7c34ee83584 to your computer and use it in GitHub Desktop.
Get a file from the project resources.
using (Stream stream = this.GetType().Assembly.GetManifestResourceStream("App.Resources." + "File.ext"))
{
if (stream == null)
{
throw new ArgumentException("No such resource", "File.ext");
}
using (Stream output = File.OpenWrite(currentAnalysisPath + $@"\Resources\File.ext"))
{
stream.CopyTo(output);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment