Code-snippet or short cut to create a constructor in Visual Studio
up vote
130
down vote
favorite
What is the code-snippet or shortcut to create a constructor in Visual Studio?
Visual Studio 2010 and C#.
I've used it before, but I can't remember.
c# visual-studio constructor code-snippets shortcut
add a comment |
up vote
130
down vote
favorite
What is the code-snippet or shortcut to create a constructor in Visual Studio?
Visual Studio 2010 and C#.
I've used it before, but I can't remember.
c# visual-studio constructor code-snippets shortcut
add a comment |
up vote
130
down vote
favorite
up vote
130
down vote
favorite
What is the code-snippet or shortcut to create a constructor in Visual Studio?
Visual Studio 2010 and C#.
I've used it before, but I can't remember.
c# visual-studio constructor code-snippets shortcut
What is the code-snippet or shortcut to create a constructor in Visual Studio?
Visual Studio 2010 and C#.
I've used it before, but I can't remember.
c# visual-studio constructor code-snippets shortcut
c# visual-studio constructor code-snippets shortcut
edited Sep 26 at 17:31
Peter Mortensen
13.3k1983111
13.3k1983111
asked Oct 6 '10 at 14:42
user467058
add a comment |
add a comment |
13 Answers
13
active
oldest
votes
up vote
263
down vote
accepted
Type "ctor" + TAB + TAB (hit the Tab key twice). This will create the default constructor for the class you are in:
public MyClass()
{
}
It seems that in some cases you will have to press TAB twice.
7
Minor correction, I think you need to hitTab
twice.
– Hans Olsson
Oct 6 '10 at 14:47
@ho1: it works if you press tab once.
– Amra
Oct 6 '10 at 14:49
Not for me (typingctor
only shows the intellisense box, then I have to typeTab
once to close that and once to "use" the snippet), but might be some setting somewhere...
– Hans Olsson
Oct 6 '10 at 16:02
1
In addition to this technique. If you make use of the class with a specific signature, you can refactor to get visual studio to generate the constructor for you. Also if this is a default constructor and you are not doing anything with it, then it is assumed to be there by default.
– James
Jul 15 '12 at 10:49
1
Once or twice is a setting thing. I had this issue with a 1-letter-snippet and changed some (IntelliSense) settings to make 1Tab
work.ctor
works for me with 1 hit though.
– Bitterblue
Mar 3 '14 at 7:54
|
show 6 more comments
up vote
19
down vote
If you want to see the list of all available snippets:
Press Ctrl + K and then X.
add a comment |
up vote
6
down vote
Type ctor
, and then press TAB twice.
add a comment |
up vote
5
down vote
For the full list of snippets (little bits of prefabricated code) press Ctrl+K and then Ctrl+X.
Source from MSDN.
Works in Visual Studio 2013 with a C# project.
So how to make a constructor
- Press Ctrl+K and then Ctrl+X
- Select Visual C#
- Select ctor
- Press Tab
Update: You can also right-click in your code where you want the snippet, and select Insert Snippet from the right-click menu
add a comment |
up vote
4
down vote
In Visual Studio 2010, if you type "ctor" (without the quotes), IntelliSense should load, showing you "ctor" in the list. Now press TAB twice, and you should have generated an empty constructor.
add a comment |
up vote
3
down vote
Simply type ctor
then press TAB.
add a comment |
up vote
3
down vote
Type ctor, and then press the Tab key.
add a comment |
up vote
3
down vote
Type ctor
and Tab.
ََََََََََ
add a comment |
up vote
2
down vote
I don't know about Visual Studio 2010, but in Visual Studio 2008 the code snippet is 'ctor'.
It is the same for vs-2008 and vs-2008, and I think is also the same for vs-2005 but not 100% sure.
– Amra
Oct 6 '10 at 14:48
add a comment |
up vote
2
down vote
Type the name of any code snippet and press TAB.
To get code for properties you need to choose the correct option and press TAB twice because Visual Studio has more than one option which starts with 'prop', like 'prop', 'propa', and 'propdp'.
add a comment |
up vote
1
down vote
For Visual Studio 2017 press "Ctrl + ."
1
It doesn't work for generating a constructor.
– azish
Aug 24 at 12:04
1
I tried and it's working.. Please read this link docs.microsoft.com/en-us/visualstudio/ide/reference/…
– sadrag
Aug 24 at 12:25
add a comment |
up vote
1
down vote
Should you be interested in creating the 'ctor' or a similar class-name-injecting snippet from scratch, create a .snippet file in the C# snippets directory (for example C:VS2017VC#Snippets1033Visual C#C#Snippets.snippet
) with this XML content:
<CodeSnippets>
<CodeSnippet>
<Header>
<Title>ctor</Title>
<Shortcut>ctor</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="false"><ID>classname</ID><Function>ClassName()</Function></Literal>
</Declarations>
<Code>
<![CDATA[public $classname$($end$)
{
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
This snippet injects the current class name by way of calling C# code snippet function ClassName(), detailed on this docs.microsoft page.
The end result of expanding this code snippet:
add a comment |
up vote
0
down vote
As mentioned by many "ctor" and double TAB works in Visual Studio 2017 but it only creates the constructor with none of the attributes.
To auto-generate with attributes (if there are any), just click on an empty line below them and press CTRL+.. It'll display a small pop-up from which you can select the "Generate Constructor..." option.
add a comment |
13 Answers
13
active
oldest
votes
13 Answers
13
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
263
down vote
accepted
Type "ctor" + TAB + TAB (hit the Tab key twice). This will create the default constructor for the class you are in:
public MyClass()
{
}
It seems that in some cases you will have to press TAB twice.
7
Minor correction, I think you need to hitTab
twice.
– Hans Olsson
Oct 6 '10 at 14:47
@ho1: it works if you press tab once.
– Amra
Oct 6 '10 at 14:49
Not for me (typingctor
only shows the intellisense box, then I have to typeTab
once to close that and once to "use" the snippet), but might be some setting somewhere...
– Hans Olsson
Oct 6 '10 at 16:02
1
In addition to this technique. If you make use of the class with a specific signature, you can refactor to get visual studio to generate the constructor for you. Also if this is a default constructor and you are not doing anything with it, then it is assumed to be there by default.
– James
Jul 15 '12 at 10:49
1
Once or twice is a setting thing. I had this issue with a 1-letter-snippet and changed some (IntelliSense) settings to make 1Tab
work.ctor
works for me with 1 hit though.
– Bitterblue
Mar 3 '14 at 7:54
|
show 6 more comments
up vote
263
down vote
accepted
Type "ctor" + TAB + TAB (hit the Tab key twice). This will create the default constructor for the class you are in:
public MyClass()
{
}
It seems that in some cases you will have to press TAB twice.
7
Minor correction, I think you need to hitTab
twice.
– Hans Olsson
Oct 6 '10 at 14:47
@ho1: it works if you press tab once.
– Amra
Oct 6 '10 at 14:49
Not for me (typingctor
only shows the intellisense box, then I have to typeTab
once to close that and once to "use" the snippet), but might be some setting somewhere...
– Hans Olsson
Oct 6 '10 at 16:02
1
In addition to this technique. If you make use of the class with a specific signature, you can refactor to get visual studio to generate the constructor for you. Also if this is a default constructor and you are not doing anything with it, then it is assumed to be there by default.
– James
Jul 15 '12 at 10:49
1
Once or twice is a setting thing. I had this issue with a 1-letter-snippet and changed some (IntelliSense) settings to make 1Tab
work.ctor
works for me with 1 hit though.
– Bitterblue
Mar 3 '14 at 7:54
|
show 6 more comments
up vote
263
down vote
accepted
up vote
263
down vote
accepted
Type "ctor" + TAB + TAB (hit the Tab key twice). This will create the default constructor for the class you are in:
public MyClass()
{
}
It seems that in some cases you will have to press TAB twice.
Type "ctor" + TAB + TAB (hit the Tab key twice). This will create the default constructor for the class you are in:
public MyClass()
{
}
It seems that in some cases you will have to press TAB twice.
edited Sep 26 at 18:47
Peter Mortensen
13.3k1983111
13.3k1983111
answered Oct 6 '10 at 14:45
Amra
13.3k237288
13.3k237288
7
Minor correction, I think you need to hitTab
twice.
– Hans Olsson
Oct 6 '10 at 14:47
@ho1: it works if you press tab once.
– Amra
Oct 6 '10 at 14:49
Not for me (typingctor
only shows the intellisense box, then I have to typeTab
once to close that and once to "use" the snippet), but might be some setting somewhere...
– Hans Olsson
Oct 6 '10 at 16:02
1
In addition to this technique. If you make use of the class with a specific signature, you can refactor to get visual studio to generate the constructor for you. Also if this is a default constructor and you are not doing anything with it, then it is assumed to be there by default.
– James
Jul 15 '12 at 10:49
1
Once or twice is a setting thing. I had this issue with a 1-letter-snippet and changed some (IntelliSense) settings to make 1Tab
work.ctor
works for me with 1 hit though.
– Bitterblue
Mar 3 '14 at 7:54
|
show 6 more comments
7
Minor correction, I think you need to hitTab
twice.
– Hans Olsson
Oct 6 '10 at 14:47
@ho1: it works if you press tab once.
– Amra
Oct 6 '10 at 14:49
Not for me (typingctor
only shows the intellisense box, then I have to typeTab
once to close that and once to "use" the snippet), but might be some setting somewhere...
– Hans Olsson
Oct 6 '10 at 16:02
1
In addition to this technique. If you make use of the class with a specific signature, you can refactor to get visual studio to generate the constructor for you. Also if this is a default constructor and you are not doing anything with it, then it is assumed to be there by default.
– James
Jul 15 '12 at 10:49
1
Once or twice is a setting thing. I had this issue with a 1-letter-snippet and changed some (IntelliSense) settings to make 1Tab
work.ctor
works for me with 1 hit though.
– Bitterblue
Mar 3 '14 at 7:54
7
7
Minor correction, I think you need to hit
Tab
twice.– Hans Olsson
Oct 6 '10 at 14:47
Minor correction, I think you need to hit
Tab
twice.– Hans Olsson
Oct 6 '10 at 14:47
@ho1: it works if you press tab once.
– Amra
Oct 6 '10 at 14:49
@ho1: it works if you press tab once.
– Amra
Oct 6 '10 at 14:49
Not for me (typing
ctor
only shows the intellisense box, then I have to type Tab
once to close that and once to "use" the snippet), but might be some setting somewhere...– Hans Olsson
Oct 6 '10 at 16:02
Not for me (typing
ctor
only shows the intellisense box, then I have to type Tab
once to close that and once to "use" the snippet), but might be some setting somewhere...– Hans Olsson
Oct 6 '10 at 16:02
1
1
In addition to this technique. If you make use of the class with a specific signature, you can refactor to get visual studio to generate the constructor for you. Also if this is a default constructor and you are not doing anything with it, then it is assumed to be there by default.
– James
Jul 15 '12 at 10:49
In addition to this technique. If you make use of the class with a specific signature, you can refactor to get visual studio to generate the constructor for you. Also if this is a default constructor and you are not doing anything with it, then it is assumed to be there by default.
– James
Jul 15 '12 at 10:49
1
1
Once or twice is a setting thing. I had this issue with a 1-letter-snippet and changed some (IntelliSense) settings to make 1
Tab
work. ctor
works for me with 1 hit though.– Bitterblue
Mar 3 '14 at 7:54
Once or twice is a setting thing. I had this issue with a 1-letter-snippet and changed some (IntelliSense) settings to make 1
Tab
work. ctor
works for me with 1 hit though.– Bitterblue
Mar 3 '14 at 7:54
|
show 6 more comments
up vote
19
down vote
If you want to see the list of all available snippets:
Press Ctrl + K and then X.
add a comment |
up vote
19
down vote
If you want to see the list of all available snippets:
Press Ctrl + K and then X.
add a comment |
up vote
19
down vote
up vote
19
down vote
If you want to see the list of all available snippets:
Press Ctrl + K and then X.
If you want to see the list of all available snippets:
Press Ctrl + K and then X.
edited Sep 26 at 19:21
Peter Mortensen
13.3k1983111
13.3k1983111
answered May 28 '15 at 7:23
ANewGuyInTown
1,96111116
1,96111116
add a comment |
add a comment |
up vote
6
down vote
Type ctor
, and then press TAB twice.
add a comment |
up vote
6
down vote
Type ctor
, and then press TAB twice.
add a comment |
up vote
6
down vote
up vote
6
down vote
Type ctor
, and then press TAB twice.
Type ctor
, and then press TAB twice.
edited Sep 26 at 18:55
Peter Mortensen
13.3k1983111
13.3k1983111
answered Oct 28 '14 at 11:00
ssmsnet
8962912
8962912
add a comment |
add a comment |
up vote
5
down vote
For the full list of snippets (little bits of prefabricated code) press Ctrl+K and then Ctrl+X.
Source from MSDN.
Works in Visual Studio 2013 with a C# project.
So how to make a constructor
- Press Ctrl+K and then Ctrl+X
- Select Visual C#
- Select ctor
- Press Tab
Update: You can also right-click in your code where you want the snippet, and select Insert Snippet from the right-click menu
add a comment |
up vote
5
down vote
For the full list of snippets (little bits of prefabricated code) press Ctrl+K and then Ctrl+X.
Source from MSDN.
Works in Visual Studio 2013 with a C# project.
So how to make a constructor
- Press Ctrl+K and then Ctrl+X
- Select Visual C#
- Select ctor
- Press Tab
Update: You can also right-click in your code where you want the snippet, and select Insert Snippet from the right-click menu
add a comment |
up vote
5
down vote
up vote
5
down vote
For the full list of snippets (little bits of prefabricated code) press Ctrl+K and then Ctrl+X.
Source from MSDN.
Works in Visual Studio 2013 with a C# project.
So how to make a constructor
- Press Ctrl+K and then Ctrl+X
- Select Visual C#
- Select ctor
- Press Tab
Update: You can also right-click in your code where you want the snippet, and select Insert Snippet from the right-click menu
For the full list of snippets (little bits of prefabricated code) press Ctrl+K and then Ctrl+X.
Source from MSDN.
Works in Visual Studio 2013 with a C# project.
So how to make a constructor
- Press Ctrl+K and then Ctrl+X
- Select Visual C#
- Select ctor
- Press Tab
Update: You can also right-click in your code where you want the snippet, and select Insert Snippet from the right-click menu
edited Jul 24 '15 at 7:11
answered Jul 14 '15 at 10:41
Marleen Schilt
6081323
6081323
add a comment |
add a comment |
up vote
4
down vote
In Visual Studio 2010, if you type "ctor" (without the quotes), IntelliSense should load, showing you "ctor" in the list. Now press TAB twice, and you should have generated an empty constructor.
add a comment |
up vote
4
down vote
In Visual Studio 2010, if you type "ctor" (without the quotes), IntelliSense should load, showing you "ctor" in the list. Now press TAB twice, and you should have generated an empty constructor.
add a comment |
up vote
4
down vote
up vote
4
down vote
In Visual Studio 2010, if you type "ctor" (without the quotes), IntelliSense should load, showing you "ctor" in the list. Now press TAB twice, and you should have generated an empty constructor.
In Visual Studio 2010, if you type "ctor" (without the quotes), IntelliSense should load, showing you "ctor" in the list. Now press TAB twice, and you should have generated an empty constructor.
edited Sep 26 at 18:53
Peter Mortensen
13.3k1983111
13.3k1983111
answered Feb 4 '13 at 17:07
Sifou13
30623
30623
add a comment |
add a comment |
up vote
3
down vote
Simply type ctor
then press TAB.
add a comment |
up vote
3
down vote
Simply type ctor
then press TAB.
add a comment |
up vote
3
down vote
up vote
3
down vote
Simply type ctor
then press TAB.
Simply type ctor
then press TAB.
edited Jul 14 '15 at 12:33
Marleen Schilt
6081323
6081323
answered Oct 6 '10 at 14:46
Oded
405k70731899
405k70731899
add a comment |
add a comment |
up vote
3
down vote
Type ctor, and then press the Tab key.
add a comment |
up vote
3
down vote
Type ctor, and then press the Tab key.
add a comment |
up vote
3
down vote
up vote
3
down vote
Type ctor, and then press the Tab key.
Type ctor, and then press the Tab key.
edited Sep 26 at 18:48
Peter Mortensen
13.3k1983111
13.3k1983111
answered Oct 6 '10 at 14:49
MuhammadHani
6,36342344
6,36342344
add a comment |
add a comment |
up vote
3
down vote
Type ctor
and Tab.
ََََََََََ
add a comment |
up vote
3
down vote
Type ctor
and Tab.
ََََََََََ
add a comment |
up vote
3
down vote
up vote
3
down vote
Type ctor
and Tab.
ََََََََََ
Type ctor
and Tab.
ََََََََََ
edited Sep 26 at 18:50
Peter Mortensen
13.3k1983111
13.3k1983111
answered Oct 11 '12 at 16:30
Jay
528
528
add a comment |
add a comment |
up vote
2
down vote
I don't know about Visual Studio 2010, but in Visual Studio 2008 the code snippet is 'ctor'.
It is the same for vs-2008 and vs-2008, and I think is also the same for vs-2005 but not 100% sure.
– Amra
Oct 6 '10 at 14:48
add a comment |
up vote
2
down vote
I don't know about Visual Studio 2010, but in Visual Studio 2008 the code snippet is 'ctor'.
It is the same for vs-2008 and vs-2008, and I think is also the same for vs-2005 but not 100% sure.
– Amra
Oct 6 '10 at 14:48
add a comment |
up vote
2
down vote
up vote
2
down vote
I don't know about Visual Studio 2010, but in Visual Studio 2008 the code snippet is 'ctor'.
I don't know about Visual Studio 2010, but in Visual Studio 2008 the code snippet is 'ctor'.
edited Sep 26 at 18:24
Peter Mortensen
13.3k1983111
13.3k1983111
answered Oct 6 '10 at 14:46
M_J_O_N_E_S
563
563
It is the same for vs-2008 and vs-2008, and I think is also the same for vs-2005 but not 100% sure.
– Amra
Oct 6 '10 at 14:48
add a comment |
It is the same for vs-2008 and vs-2008, and I think is also the same for vs-2005 but not 100% sure.
– Amra
Oct 6 '10 at 14:48
It is the same for vs-2008 and vs-2008, and I think is also the same for vs-2005 but not 100% sure.
– Amra
Oct 6 '10 at 14:48
It is the same for vs-2008 and vs-2008, and I think is also the same for vs-2005 but not 100% sure.
– Amra
Oct 6 '10 at 14:48
add a comment |
up vote
2
down vote
Type the name of any code snippet and press TAB.
To get code for properties you need to choose the correct option and press TAB twice because Visual Studio has more than one option which starts with 'prop', like 'prop', 'propa', and 'propdp'.
add a comment |
up vote
2
down vote
Type the name of any code snippet and press TAB.
To get code for properties you need to choose the correct option and press TAB twice because Visual Studio has more than one option which starts with 'prop', like 'prop', 'propa', and 'propdp'.
add a comment |
up vote
2
down vote
up vote
2
down vote
Type the name of any code snippet and press TAB.
To get code for properties you need to choose the correct option and press TAB twice because Visual Studio has more than one option which starts with 'prop', like 'prop', 'propa', and 'propdp'.
Type the name of any code snippet and press TAB.
To get code for properties you need to choose the correct option and press TAB twice because Visual Studio has more than one option which starts with 'prop', like 'prop', 'propa', and 'propdp'.
edited Sep 26 at 18:55
Peter Mortensen
13.3k1983111
13.3k1983111
answered Jun 5 '13 at 9:29
denish
211
211
add a comment |
add a comment |
up vote
1
down vote
For Visual Studio 2017 press "Ctrl + ."
1
It doesn't work for generating a constructor.
– azish
Aug 24 at 12:04
1
I tried and it's working.. Please read this link docs.microsoft.com/en-us/visualstudio/ide/reference/…
– sadrag
Aug 24 at 12:25
add a comment |
up vote
1
down vote
For Visual Studio 2017 press "Ctrl + ."
1
It doesn't work for generating a constructor.
– azish
Aug 24 at 12:04
1
I tried and it's working.. Please read this link docs.microsoft.com/en-us/visualstudio/ide/reference/…
– sadrag
Aug 24 at 12:25
add a comment |
up vote
1
down vote
up vote
1
down vote
For Visual Studio 2017 press "Ctrl + ."
For Visual Studio 2017 press "Ctrl + ."
answered Oct 20 '17 at 12:21
sadrag
618
618
1
It doesn't work for generating a constructor.
– azish
Aug 24 at 12:04
1
I tried and it's working.. Please read this link docs.microsoft.com/en-us/visualstudio/ide/reference/…
– sadrag
Aug 24 at 12:25
add a comment |
1
It doesn't work for generating a constructor.
– azish
Aug 24 at 12:04
1
I tried and it's working.. Please read this link docs.microsoft.com/en-us/visualstudio/ide/reference/…
– sadrag
Aug 24 at 12:25
1
1
It doesn't work for generating a constructor.
– azish
Aug 24 at 12:04
It doesn't work for generating a constructor.
– azish
Aug 24 at 12:04
1
1
I tried and it's working.. Please read this link docs.microsoft.com/en-us/visualstudio/ide/reference/…
– sadrag
Aug 24 at 12:25
I tried and it's working.. Please read this link docs.microsoft.com/en-us/visualstudio/ide/reference/…
– sadrag
Aug 24 at 12:25
add a comment |
up vote
1
down vote
Should you be interested in creating the 'ctor' or a similar class-name-injecting snippet from scratch, create a .snippet file in the C# snippets directory (for example C:VS2017VC#Snippets1033Visual C#C#Snippets.snippet
) with this XML content:
<CodeSnippets>
<CodeSnippet>
<Header>
<Title>ctor</Title>
<Shortcut>ctor</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="false"><ID>classname</ID><Function>ClassName()</Function></Literal>
</Declarations>
<Code>
<![CDATA[public $classname$($end$)
{
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
This snippet injects the current class name by way of calling C# code snippet function ClassName(), detailed on this docs.microsoft page.
The end result of expanding this code snippet:
add a comment |
up vote
1
down vote
Should you be interested in creating the 'ctor' or a similar class-name-injecting snippet from scratch, create a .snippet file in the C# snippets directory (for example C:VS2017VC#Snippets1033Visual C#C#Snippets.snippet
) with this XML content:
<CodeSnippets>
<CodeSnippet>
<Header>
<Title>ctor</Title>
<Shortcut>ctor</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="false"><ID>classname</ID><Function>ClassName()</Function></Literal>
</Declarations>
<Code>
<![CDATA[public $classname$($end$)
{
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
This snippet injects the current class name by way of calling C# code snippet function ClassName(), detailed on this docs.microsoft page.
The end result of expanding this code snippet:
add a comment |
up vote
1
down vote
up vote
1
down vote
Should you be interested in creating the 'ctor' or a similar class-name-injecting snippet from scratch, create a .snippet file in the C# snippets directory (for example C:VS2017VC#Snippets1033Visual C#C#Snippets.snippet
) with this XML content:
<CodeSnippets>
<CodeSnippet>
<Header>
<Title>ctor</Title>
<Shortcut>ctor</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="false"><ID>classname</ID><Function>ClassName()</Function></Literal>
</Declarations>
<Code>
<![CDATA[public $classname$($end$)
{
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
This snippet injects the current class name by way of calling C# code snippet function ClassName(), detailed on this docs.microsoft page.
The end result of expanding this code snippet:
Should you be interested in creating the 'ctor' or a similar class-name-injecting snippet from scratch, create a .snippet file in the C# snippets directory (for example C:VS2017VC#Snippets1033Visual C#C#Snippets.snippet
) with this XML content:
<CodeSnippets>
<CodeSnippet>
<Header>
<Title>ctor</Title>
<Shortcut>ctor</Shortcut>
</Header>
<Snippet>
<Declarations>
<Literal Editable="false"><ID>classname</ID><Function>ClassName()</Function></Literal>
</Declarations>
<Code>
<![CDATA[public $classname$($end$)
{
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
This snippet injects the current class name by way of calling C# code snippet function ClassName(), detailed on this docs.microsoft page.
The end result of expanding this code snippet:
edited Sep 26 at 19:23
Peter Mortensen
13.3k1983111
13.3k1983111
answered Sep 6 '17 at 14:57
Neil Justice
5742621
5742621
add a comment |
add a comment |
up vote
0
down vote
As mentioned by many "ctor" and double TAB works in Visual Studio 2017 but it only creates the constructor with none of the attributes.
To auto-generate with attributes (if there are any), just click on an empty line below them and press CTRL+.. It'll display a small pop-up from which you can select the "Generate Constructor..." option.
add a comment |
up vote
0
down vote
As mentioned by many "ctor" and double TAB works in Visual Studio 2017 but it only creates the constructor with none of the attributes.
To auto-generate with attributes (if there are any), just click on an empty line below them and press CTRL+.. It'll display a small pop-up from which you can select the "Generate Constructor..." option.
add a comment |
up vote
0
down vote
up vote
0
down vote
As mentioned by many "ctor" and double TAB works in Visual Studio 2017 but it only creates the constructor with none of the attributes.
To auto-generate with attributes (if there are any), just click on an empty line below them and press CTRL+.. It'll display a small pop-up from which you can select the "Generate Constructor..." option.
As mentioned by many "ctor" and double TAB works in Visual Studio 2017 but it only creates the constructor with none of the attributes.
To auto-generate with attributes (if there are any), just click on an empty line below them and press CTRL+.. It'll display a small pop-up from which you can select the "Generate Constructor..." option.
answered Nov 10 at 19:14
nuwanjaya
118111
118111
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3873702%2fcode-snippet-or-short-cut-to-create-a-constructor-in-visual-studio%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown