dotnet-Snippets.com
Snippets: 57 | Registered User: 27 | Visitors online: 11
Main Menu

Home
Random Snippet
FAQs
Contact Us
Imprint
RSS Feeds

Rss All languages
Rss C#
Rss VB.NET
Rss C++
Rss J#
Rss ASP.NET
Google Ads

Sri Lanka .NET 
                Forum Member
Loads an embedded resource file of the calling assembly.

Author: Guest
Programming Language: C# Rating:
not yet rated

Views: 772

Description:

Loads an embedded resource file of the calling assembly.



C#
1
2
3
4
5
6
7
8
9
/// <summary>
/// Loads an embedded resource file of the calling assembly.
/// </summary>
/// <param name="embeddedFileName">Filename to load, e.g. "data.xml"</param>
/// <returns>Stream to the embedded resource</returns>
public static Stream GetResourceStream(string embeddedFileName) {
    Stream stream = Assembly.GetCallingAssembly().GetManifestResourceStream(Assembly.GetCallingAssembly().GetName().Name + ".Resources." + embeddedFileName);
    return stream;
}


Poor Excellent
1 2 3 4 5 6 7 8 9 10
Sign in to vote for this snippet.

Comments:
(Please log in to wrtite an comment.)