Created
April 6, 2018 09:57
-
-
Save ChadRoberts21/554714cc8fafdf8aa1583ade5b9d4abe to your computer and use it in GitHub Desktop.
Utils - File Stream - Custom File Stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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