Visual Studio-是否可以选择多个文件并在每个文件中包装名称空间? [英] Visual studio - is there a way to select multiple files and wrap a namespace around each of them?

查看:89
本文介绍了Visual Studio-是否可以选择多个文件并在每个文件中包装名称空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以选择文件夹中的所有类,并在Visual Studio中为每个类分配名称空间?

Is there a way to select all classes within a folder and assign a namespace to each of them in visual studio?

如果没有工具可以做到,是否有一个正则表达式模式可以匹配类声明之前但导入之后的所有内容?

If there is no tool to do it, is there a regex pattern that will match everything before the class declatarion, but after the imports?

推荐答案

Resharper具有更改文件名称空间的功能.

对于手动解决方案,您可以:

For a manual solution, you could:

  • 关闭解决方案中的所有文件
  • 仅打开那些需要更改名称空间的文件
  • 执行查找和替换namespace oldnamespace new
  • close all files in your solution
  • open only those files who need their namespace changed
  • perform a find-and-replace for namespace old to namespace new

这篇关于Visual Studio-是否可以选择多个文件并在每个文件中包装名称空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆