快速或自动使用模板参数 [英] Using template parameters quickly or automatically

查看:71
本文介绍了快速或自动使用模板参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在代码文件中使用模板参数& .cs项目文件是一个手动任务,如果解决方案中存在许多项目,并且项目依赖项,则替换将花费相当长的时间。那么,有什么方法可以自动使用模板
参数或任何快速使用模板参数的方法吗?

解决方案

Hi Yug Nar ula,


您可以编写一个控制台App,它可以获取项目文件夹中的所有代码文件,并使用重命名文件
FileInfo。 像这样:

 DirectoryInfo d = new DirectoryInfo(@"C:\DirectoryToAccess"); 
FileInfo [] infos = d.GetFiles();
foreach(信息中的FileInfo f)
{
File.Move(f.FullName,f.FullName.ToString()。Replace(" abc","


ABC

"));
}

祝你好运,


Cole Wu


Using Template parameters in code files & .cs project files is a manual task and If there are many projects in a solution and project dependencies with in it, the replacement will take quite some time. So, Is there any way I can make use of template parameters automatically or any quick way to use template parameters?

解决方案

Hi Yug Narula,

You could write a console App, which get all code files in the project folder, and rename the files by using FileInfo. like this:

DirectoryInfo d = new DirectoryInfo(@"C:\DirectoryToAccess");
FileInfo[] infos = d.GetFiles();
foreach(FileInfo f in infos)
{
    File.Move(f.FullName, f.FullName.ToString().Replace("abc","


abc


")); }

Best regards,

Cole Wu


这篇关于快速或自动使用模板参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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