简体   繁体   English

加载资源文件中的字符串时触发的事件

[英]Event that is triggered when a string from the resourcefile is loaded

I want a custom version of my strings in resource file but I dont want to create it completly new because it's just for a short period of time. 我想要资源文件中字符串的自定义版本,但我不想创建一个全新的字符串,因为它只是很短的一段时间。

Is there any way to trigger an event when my program calls Properties.Resources.MyString so I can manipulate it before it is shown to the user? 当我的程序调用Properties.Resources.MyString时,有什么方法可以触发事件,以便在显示给用户之前可以对其进行操作?

You can do that by changing Resources class (look at generated code), but the drawback is that this class is regenerated each time you add/change something in resources file. 您可以通过更改Resources类(查看生成的代码)来做到这一点,但是缺点是,每次在资源文件中添加/更改某些内容时都会重新生成此类。 You can omit that problem by implementing your own generation tool, read this: Extended Strongly Typed Resource Generator 您可以通过实现自己的生成工具来忽略该问题,请阅读: 扩展的强类型资源生成器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM