In Visual Studio 2015 when I type prop
and then hit tab I invoke the auto-property snippet and get this:
public property int MyProperty
{ get; set; }
But what I want is this:
public property MyProperty { get; set; }
How can I make the snippet place the code on 1 line?
I've checked the XML file at:
C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC#\\Snippets\\1033\\Visual C#\\prop.snippet
But it looks okay to me:
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>Property type</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>property</ID>
<ToolTip>Property name</ToolTip>
<Default>MyProperty</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[public $type$ $property$ { get; set; }$end$]]>
</Code>
I have not got ReSharper installed.
In Options > Text Editor > C# > Formatting > Wrapping
I have it set to:
By checking both of these I get the results I want. It's a little unintuitive as both options affect both results (as opposed to the top option affecting the top result and the bottom option affecting the bottom result), and as such, I have to now allow this when I don't want to:
int i = 0; string name = "John";
Ah well, problem (kinda) solved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.