当前位置: 首页 > news >正文

网站开发 旅游福州网络营销网站

网站开发 旅游,福州网络营销网站,北京好网站制作公司哪家好,企业咨询公司是做什么的点击上方蓝字关注“汪宇杰博客”在 Visual Studio 中#xff0c;如果我们在一个 .NET Core 工程里加入了一个资源文件#xff08;.resx#xff09;#xff0c;那么你会发现有个对应的 .Designer.cs 文件被自动生成了#xff0c;每次资源文件的内容有变化#xff0c;这个设… 点击上方蓝字关注“汪宇杰博客”在 Visual Studio 中如果我们在一个 .NET Core 工程里加入了一个资源文件.resx那么你会发现有个对应的 .Designer.cs 文件被自动生成了每次资源文件的内容有变化这个设计器文件都会刷新。它本质上就是对应资源文件里的键值对自动生成访问这些资源的方法。生成的代码就像这样private static global::System.Resources.ResourceManager resourceMan;private static global::System.Globalization.CultureInfo resourceCulture;[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(Microsoft.Performance, CA1811:AvoidUncalledPrivateCode)]internal DataResource() {}/// summary///   Returns the cached ResourceManager instance used by this class./// /summary[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]internal static global::System.Resources.ResourceManager ResourceManager {    get {        if (object.ReferenceEquals(resourceMan, null)) {            global::System.Resources.ResourceManager temp new global::System.Resources.ResourceManager(Moonglade.Setup.Data.DataResource, typeof(DataResource).Assembly);            resourceMan temp;        }        return resourceMan;    }}/// summary///   Overrides the current threads CurrentUICulture property for all///   resource lookups using this strongly typed resource class./// /summary[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]internal static global::System.Globalization.CultureInfo Culture {    get {        return resourceCulture;    }    set {        resourceCulture value;    }}对于资源文件里的每个Key都会有个方法来读它的值/// summary///   Looks up a localized string similar to {quot;Namequot;:quot;Adminquot;,quot;Descriptionquot;:quot;MoongladeAdminquot;,quot;ShortDescriptionquot;:quot;Moonglade Adminquot;,quot;AvatarBase64quot;:quot;quot;}./// /summaryinternal static string BlogOwnerSettings {    get {        return ResourceManager.GetString(BlogOwnerSettings, resourceCulture);    }}但是我不希望使用这些代码来读取资源文件。因此我需要禁用自动生成Desinger.cs文件。事实上这个Designer.cs文件的生产方式是通过CustomTool生成的就像EF4-6时候通过T4模板生成代码一样也是一种CustomTool。给资源文件.resx生成对应的 .Designer.cs 文件的CustomTool叫做ResXFileCodeGenerator在 Visual Studio 中你可以在RESX文件的属性窗口里将它设置为 reset to default 从而关闭这货如果你用的是 Visual Studio Code可以手工编辑csproj文件删除这段ItemGroup  Compile UpdateData\DataResource.Designer.cs    DesignTimeTrue/DesignTime    AutoGenTrue/AutoGen    DependentUponDataResource.resx/DependentUpon  /Compile/ItemGroupItemGroup  EmbeddedResource UpdateData\DataResource.resx    GeneratorResXFileCodeGenerator/Generator    LastGenOutputDataResource.Designer.cs/LastGenOutput  /EmbeddedResource/ItemGroup那么现在我们如何从资源文件里读取字符串呢很简单ResourceManager rm new ResourceManager(Moonglade.Setup.Data.DataResource, Assembly.GetExecutingAssembly());rm.GetString(Your_Resource_Key);
http://www.huolong8.cn/news/302711/

相关文章:

  • 丹阳网站建设制作怎么做网站教程简单
  • 智能网站平台最火的做网站源码语言
  • 银河麒麟软件下载网站天一建设网站
  • 搬瓦工vps wordpress连云港网站推广优化
  • 淘宝网站设计模板下载深圳专门做网站的公司
  • 网站选项按钮深圳建设交易中心网站
  • 公司域名让做网站的wordpress评论链接
  • 网站建设近五年参考文献seo是搜索引擎优化
  • 做网站,好苦逼腾讯云wordpress插件下载失败
  • 定制开发产品桂林seo排名
  • 津南天津网站建设柳州人社app下载
  • 颖灵信息科技网站建设做ppt用什么软件最好
  • 金融直播间网站开发wordpress留言板模板
  • 重庆制作网站速成班网站规划html
  • 淄博电商网站建设淘宝店网页制作教程
  • 做视频网站视频有没有帮忙做推广的网站
  • 网站建设规划申请昆山做网站的公司有哪些
  • 网站开发毕业设计任务书范文设计方案怎么做
  • 合肥网站建设市场足球比方类网站开发
  • 北京建设工程质量总站网站wordpress 修改教程
  • 为企业进行网站建设方案免费推广网站排名
  • 亚马逊 怎么做国外网站免费搭建博客网站
  • 网站优化链接无锡百度快照优化排名
  • 网站设计深圳要联系方式吗?专业做网站的公司邢台专业做网站
  • 桂城网站制作wordpress+移动
  • 营口网站建设价格哪个网站跨境电商做的最好
  • 网站布局方式工作场所的职业病危害因素强度或者浓度应当符合
  • 高权重网站做员会来顶排名网站开发有哪些新技术
  • 网站规划与建设心得体会网站设计思路作用
  • 专业零基础网站建设教学在哪里静安网站建设哪家好