[英]Does Visual Studio include a search & replace that keeps the 'wildcard' value?
我将一个 ASP.NET 4.5 应用程序转换为 .NET Core 3.0 一切运行顺利,但现在我想为模型添加本地化,我已经本地化了所有视图,但模型看起来不需要很多手工,因为每个模型属性上已经有一个[DisplayName("Name")]
,但我想从资源文件中获取它,所以我需要手动将其更改为[Display(Name = "Name", ResourceType = typeof(MyResources))]
我想知道是否有查找和替换功能将DisplayName
替换为Display(Name=
然后将值保留在name=
之后,然后将, ResourceType = typeof(MyResources))
到字符串的末尾。
在查找和替换对话框中启用使用正则表达式并设置:
Find what = \[DisplayName\("(\w+)"\)\]
Replace with = [Display(Name = "$1", ResourceType = typeof(MyResources))]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.