创建Visual Studio扩展以帮助我使用我的库 [英] Create Visual Studio Extension to help me with my library

查看:124
本文介绍了创建Visual Studio扩展以帮助我使用我的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!


我正在用C#创建一个库,并且有很多重复,所以我想知道是否有可能创建一个扩展/可以帮我自动化的工具,而不是我必须手动完成所有工作?


示例:

字符串X; 
String Y;
String Z;
Int32 SomeNumber;

我希望能够创建一个工具,如果我右键单击X,我会给我自动创建的选项像这样:

 internal String _X {get;组; } 
internal String _Y {get;组; }
internal String _Z {get;组; }
internal Int32 _SomeNumber {get;组; }

public String X => _X;
public String Y => _Y;
public String Z => _Z;
public Int32 SomeNumber => _SomeNumber;


有可能吗?如果是这样,我可以搜索什么来开始这样的扩展/工具?提前谢谢。


解决方案

您可以使用Roslyn创建扩展程序。



https://www.codeproject.com/articles/861548/roslyn-code-analysis-in-easy-samples-part


Hello!

I'm creating a library in C#, and there's a lot of repetition that's going on so I was wondering if it was possible to create an extension/tool which could help me automate it instead of me having to do all the work manually?

Example:

String X;
String Y;
String Z;
Int32 SomeNumber;

I wish to be able and create a tool where if I e.g right-clicked on X, I'd give me the option to automatically create something like this:

internal String _X { get; set; }
internal String _Y { get; set; }
internal String _Z { get; set; }
internal Int32 _SomeNumber { get; set; }

public String X => _X;
public String Y => _Y;
public String Z => _Z;
public Int32 SomeNumber => _SomeNumber;

Is it possible? If so, what could I search for to get started on such a extension/tool? Thank you in advance.

解决方案

You could probably create an extension using Roslyn.

https://www.codeproject.com/articles/861548/roslyn-code-analysis-in-easy-samples-part


这篇关于创建Visual Studio扩展以帮助我使用我的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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