Created
April 5, 2022 20:29
-
-
Save MiloszKrajewski/2a184edb3c288ca697c2567b73528492 to your computer and use it in GitHub Desktop.
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.Xml.Linq; | |
namespace K4os.Outbox.Resources; | |
public class EmbeddedResourceLoader | |
{ | |
public static Stream GetStream<THook>(string path) => | |
typeof(THook).Assembly.GetManifestResourceStream(typeof(THook), path) ?? | |
throw new ArgumentException($"Embedded resource '{path}' not found"); | |
public static XDocument GetXml<THook>(string path) => | |
XDocument.Load(GetStream<THook>(path)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment