VB.NET, C# Load a String From a Resource File
Listing 1. This VB.NET and C# code shows how you can retrieve a string from a resource file, or more precisely, from a resource file embedded in a .NET assembly. The .NET runtime always looks for a satellite assembly holding the resources corresponding to the culture assigned to the UI thread, and reverts to the resources stored in the main assembly if the search fails.
' [Visual Basic] ' assumes that the project's root namespace ' is CodeArchitects Dim resFile As String = "CodeArchitects.Strings" Dim resMan As New ResourceManager(resFile, _ [Assembly].GetExecutingAssembly()) Dim greetings As String = _ resMan.GetString("Greetings") // [C#] // assumes that the project's default namespace // is CodeArchitects string resFile = "CodeArchitects.Strings"; ResourceManager resMan = new ResourceManager( resFile, Assembly.GetExecutingAssembly()); string greetings = resMan.GetString("Greetings");