Getting String from Resource Files in .NET

2022年10月8日 64点热度 0人点赞 0条评论
内容目录

file
file

using System.Resources;
        var assembly = typeof(Program).Assembly;
        ResourceManager resourceManager = new ResourceManager("update.Properties.Resources", assembly);
        var host = resourceManager.GetString("host");

You can retrieve a list of resource file names using typeof(Program).Assembly.GetManifestResourceNames(), where the default Resources.resx obtained is

update.Properties.Resources.resources
{Assembly}.{Directory}.{FileName}.resources

The ResourceManager only needs to fill in {Assembly}.{Directory}.{FileName}.

痴者工良

高级程序员劝退师

文章评论