如何像 IntelliJ 中的 .sout 模板一样在 Visual Studio\Resharper 中添加 .cw 后缀模板?
How to add a .cw Postfix Template in Visual Studio\Resharper like .sout template in IntelliJ?
我正在从 Java 过渡到 C#。
在 IntelliJ 中有一个后缀模板,例如:
String expr = "John";
//writing expr.sout gives:
System.out.println(expr);
有什么方法可以创建像 expr.cw which returns Console.WriteLine(expr) 这样的模板吗?在视觉中 Studio\Resharper?
使用 JetBrains.Annotations
并创建一个 SourceTemplate 是一个可能的解决方案。
比如在项目中添加如下静态class:
using System;
using JetBrains.Annotations;
namespace SpeechRecognition
{
public static class ResharperHelper
{
[SourceTemplate]
public static void cw(this string str)
{
Console.WriteLine(str);
//$ $END$
}
}
}
我正在从 Java 过渡到 C#。 在 IntelliJ 中有一个后缀模板,例如:
String expr = "John";
//writing expr.sout gives:
System.out.println(expr);
有什么方法可以创建像 expr.cw which returns Console.WriteLine(expr) 这样的模板吗?在视觉中 Studio\Resharper?
使用 JetBrains.Annotations
并创建一个 SourceTemplate 是一个可能的解决方案。
比如在项目中添加如下静态class:
using System;
using JetBrains.Annotations;
namespace SpeechRecognition
{
public static class ResharperHelper
{
[SourceTemplate]
public static void cw(this string str)
{
Console.WriteLine(str);
//$ $END$
}
}
}