Skip to content

Instantly share code, notes, and snippets.

@ChadRoberts21
Created April 6, 2018 09:57
Show Gist options
  • Save ChadRoberts21/554714cc8fafdf8aa1583ade5b9d4abe to your computer and use it in GitHub Desktop.
Save ChadRoberts21/554714cc8fafdf8aa1583ade5b9d4abe to your computer and use it in GitHub Desktop.
Utils - File Stream - Custom File Stream
public class CustomFileStreamContent : StreamContent
{
string filePath;
public CustomFileStreamContent(Stream fileStream, string filePath) : base(content: fileStream)
{
this.filePath = filePath;
}
private CustomFileStreamContent(Stream fileStream) : base(content: fileStream)
{
}
protected override void Dispose(bool disposing)
{
//close the file stream
base.Dispose(disposing);
try
{
File.Delete(this.filePath);
}
catch (Exception ex)
{
ExceptionLogger.ToDatabase(ex);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment