有没有人制作过 VS 代码片段来基于“item”?在camelCased集合的foreach中?

发布于 2024-10-08 06:55:10 字数 796 浏览 0 评论 0原文

我一直使用 foreach 快捷方式。在很多情况下我都会做同样的事情,我认为最好保存最后一步。

顺序如下,最后一步是我希望自动发生的。

我的问题几乎是:是否有人已经做到了这一点,或者非常擅长自定义代码片段,或者非常好以至于他们可以真正快速地做到这一点?

我已经不止一次地阅读过有关代码片段的文档,并且由于某种原因拒绝为我点击这些内容之一。

I type:

foreach<tab><tab>

Result:

foreach (**var** item in collection)
{
}

I type:

<tab><tab>

Result:

foreach (var item in **collection**)
{
}

I type (using auto complete specific to my project): camp<tab>

Result:

foreach (var item in **campaignList**)
{
}

-->我想要做的是根据Camel Cased的campaignList自动使项目变成“campaign”<--

Type: shift-<tab>shift-<tab>

foreach (var **item** in campaignList)
{
}

Type: campaign<enter>

foreach (var campaign in campaignList)
{

}

I use the foreach shortcut all the time. In many cases I do the same thing and I think it would nice to save the last step.

The sequence follows, with the last step being what I'd like to have happen automatically.

My question is pretty much: has anyone already done this or is so good with a custom code snippet or so good that they could do it real quick?

I've read the docs on code snippetts more than once and it's one of those things that for some reason refuese to click for me.

I type:

foreach<tab><tab>

Result:

foreach (**var** item in collection)
{
}

I type:

<tab><tab>

Result:

foreach (var item in **collection**)
{
}

I type (using auto complete specific to my project): camp<tab>

Result:

foreach (var item in **campaignList**)
{
}

--> What I would like to do is automatically make item turn into 'campaign' here based on campaignList being camel cased <--

Type: shift-<tab>shift-<tab>

foreach (var **item** in campaignList)
{
}

Type: campaign<enter>

foreach (var campaign in campaignList)
{

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜宝宝 2024-10-15 06:55:11

您始终可以编写自己的代码片段

You can always write your own code snippets.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文