Skip to content

Instantly share code, notes, and snippets.

Created June 20, 2017 00:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
using System.IO;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace EmbeddedResource.Controllers
public class ValuesController : Controller
// GET api/values
[HttpGet, Produces("application/json")]
public async Task<string> Get()
var assembly = Assembly.GetEntryAssembly();
var resourceStream = assembly.GetManifestResourceStream("EmbeddedResource.Data.fakedata.json");
using (var reader = new StreamReader(resourceStream, Encoding.UTF8))
return await reader.ReadToEndAsync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment