All Questions
Tagged with code-snippets c#
183 questions
1
vote
1
answer
56
views
Is there a way to generate all public members object initializer in vs code?
I'm looking for behaviour similiar to JB Rider. When contructing object through initializer there's an option to generate all public property assignments. Is there a way to add this feature to vs code?...
1
vote
0
answers
97
views
What are the effects of "Show new snippet experience (experimental)" setting in Visual Studio 2022?
Recently, I have encountered a new option in Visual Studio 2022 "Show new snippet experience (experimental)" setting in Visual Studio 2022?".
It is located in the VS Options: "Text ...
3
votes
0
answers
185
views
How do you constrain Visual studio Code Snippets to a type/class context?
In my project I use reflection to find and invoke certain (optional) methods, rather than defining an interface which forces the methods to be implemented. This is partly to support parameter ...
0
votes
1
answer
256
views
Is there a way to define custom functions for C# snippets, or at least get the namespace?
I am modernizing a lot of VB.NET code to CSharp and I need to convert dozens of dialogs to conform with our new MVP standard. I'm trying to write snippets so I can more easily bang out the boiler ...
0
votes
1
answer
52
views
Visual Studio 2022 Snippets work incorrectly for C# [duplicate]
I wrote a snippet , but c# snippet code writes half of the.
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/...
0
votes
0
answers
752
views
In Visual Studio 2022, how can I change the null check template?
I frequently apply null checks to my parameters when developing in C# (like any good developer should!).
Because I can be lazy, I'd prefer to let Visual Studio add these for me, which it can.
However, ...
0
votes
2
answers
689
views
Visual Studio cw snippet works, but then doesn't when I do it again
I type 'cw' press tab twice and bam 'Console.WriteLine()' appears. I then press enter and move to another line type 'cw' press tab twice and wtf 'cw.WriteLine()' appears.
I tried throwing my computer ...
1
vote
4
answers
827
views
Code snippets don't work every time after new VS 2022 update
After I updated my VS 2022 before a couple of days, the built in snippet cw(tab+tab) for Console.WriteLine(); stopped working as before. Sometimes it works , but sometimes not. Its like 50/50 . I have ...
1
vote
0
answers
475
views
Visual Studio 2022 Default C# (CSharp) Snippets Not Showing With Intellisense
Within the last week or so, standard C# snippets like: (ctor, propfull, for, etc.) stopped showing in IntelliSense. However, if I type ctor, then press ESC to close IntelliSense, then press TAB, it ...
1
vote
1
answer
683
views
Cannot get C# Snippets to work in Visual Studio 2022
I'm not 100% sure when this started happening, but now if I type 'if' and double tab, it just puts two spaces after the if and gives me an error code saying 'Command Handler 'Snippets' has exceeded ...
0
votes
1
answer
1k
views
Unity hover documentation in Visual Studio Code
I want to use Visual Studio Code as my editor for c # code in Unity and I want to hover over the code to display a short description of what, for example, the method does.
I found this thread but I ...
0
votes
1
answer
194
views
Snippet for generating public variables in C#
private float _speed = 5;
public float Speed => _speed;
I'm trying to make it so I can generate the public reference to a private variable like this with a snippet but is proving to be a bit more ...
-1
votes
1
answer
253
views
Visual Studio 2019 Automatic Event Handlers Generation
Is it at all possible to generate handlers for ALL events object has to offer in a similar way you can do it for a single event simply by pressing tab tab after += ?
if not Visual Studio, any other ...
0
votes
1
answer
152
views
Visual studio customized snippet not shown on suggestions bar
I have a code snippet I made and I want to use it during writing code,
the problem is that the Inteli-sense not suggest the snippet I made even though
I can see it was added as expected in the snippet ...
18
votes
7
answers
12k
views
Visual Studio 2022 Snippets not working for C#
I did a fresh install of Visual Studio 2022 v17.0.0 (.NET 6.0) and created a new WebAssembly project. Tried editing Counter component but none of the snippets work for C#.
Typing cw is supposed to ...