ComponentResourceManager resourceManager = new ComponentResourceManager(typeof(Form1)); string welcomeMessage = resourceManager.GetString("WelcomeMessage");
ComponentResourceManager resourceManager = new ComponentResourceManager(typeof(Form1)); string errorMessage = resourceManager.GetString("ErrorMessage", CultureInfo.CurrentCulture);In this example, we pass in an additional argument to the GetString method - the current culture. This is because resource files can contain multiple versions of a resource string for different languages or cultures, and we need to specify which one we want to retrieve. The ComponentResourceManager class is part of the .NET Framework and is included in the System.Windows.Forms.dll library.