Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to load file from resources in c#

// required
using System.IO;
using System.Reflection;

public string GetEmbeddedResource(string namespacename, string filename)
{
    var assembly = Assembly.GetExecutingAssembly();
    var resourceName = namespacename + "." + filename;

    using (Stream stream = assembly.GetManifestResourceStream(resourceName))
    using (StreamReader reader = new StreamReader(stream))
    {
        string result = reader.ReadToEnd();
        return result;
    }
}
Comment

how to load file from resources in c#

string s = GetEmbeddedResource("SociometryTree", "Notes.txt");
Comment

PREVIOUS NEXT
Code Example
Csharp :: multidimensional arrays c# 
Csharp :: how to get the size an array in unity 
Csharp :: c# string console readline array 
Csharp :: string to chararray c# 
Csharp :: All Possible SubString of string 
Csharp :: draw on picturebox c# 
Csharp :: asp.net core identity get all roles 
Csharp :: c# debug writeline 
Csharp :: get both item and index in c# 
Csharp :: c# xml get child node by name 
Csharp :: .net core 6 autofac 
Csharp :: how to find player gameobject in unity 
Csharp :: unity model ripper 
Csharp :: how to insert value to identity column using entity framwork 
Csharp :: get int value from enum c# 
Csharp :: append an array in c# 
Csharp :: c# wpf row definition height * in code 
Csharp :: how to display array in string in c# 
Csharp :: c# list find index 
Csharp :: c# loop string 
Csharp :: unity soft body 
Csharp :: finding values in the registry 
Csharp :: c# does value exist in list 
Csharp :: c# check if object is of any generic type 
Csharp :: c# clear console read chache 
Csharp :: unity werfen mit höhe 
Csharp :: nunit cleanup after all tests 
Csharp :: c# chance of 
Csharp :: Send Hotmail/Outlook Email C# (Win/ASP.NET) 
Csharp :: telerik winforms get value of selected rows from grid 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =