Created
March 28, 2019 20:25
-
-
Save felipeslongo/3761984cd5be3bad7860c4a36e837bb3 to your computer and use it in GitHub Desktop.
Loads files with Build Action set to EmbeddedResource.
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
using System.IO; | |
using System.Reflection; | |
namespace Core.Utils | |
{ | |
public static class EmbeddedResource | |
{ | |
public static string ReadString(Assembly assembly, string @namespace ,string filename) | |
{ | |
var stream = assembly.GetManifestResourceStream($"{@namespace}.{filename}"); | |
var data = string.Empty; | |
using (var reader = new StreamReader(stream)) | |
data = reader.ReadToEnd(); | |
return data; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment