Skip to content

Instantly share code, notes, and snippets.

@MiloszKrajewski
Created April 5, 2022 20:29
Show Gist options
  • Save MiloszKrajewski/2a184edb3c288ca697c2567b73528492 to your computer and use it in GitHub Desktop.
Save MiloszKrajewski/2a184edb3c288ca697c2567b73528492 to your computer and use it in GitHub Desktop.
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