Welcome to MSDN Blogs Sign in | Join | Help

Sara Ford's Weblog

My adventures embracing open source on CodePlex and at Microsoft

News

    • Did you know... All author proceeds go directly to sending Hurricane Katrina survivors to college.

      Microsoft Visual Studio Tips book

      Recent Entries

Did you know... How to change default values and variables in a code snippet - #104

When you insert a code snippet, the editor highlights the fields (variables, values, etc) you can modify depending on how the code snippet was written.   The idea is you modify the contents of the field, then press tab to navigate to the next field.  When you press tab, that particular field is updated throughout the entire snippet.  You can also navigate outside the field via the arrow keys to invoke the update. 

For Loop C# Snippet

If you press enter, however, you will be committing both the current change (if any) and the entire snippet, meaning you can't undo to get back to those highlighted fields.  You would have to use your favorite refactoring method to make any additional updates.  I call this out because I always press enter when i meant to hit tab.  No idea why this got hard-coded into my head, so just a heads-up.

For those of you who found this tip outside the tip of the day series, you can read more about code snippets on the VS Editor Team Blog.

Technorati tags: ,
Posted: Tuesday, December 11, 2007 3:00 AM by saraford

Comments

Dennis said:

You should replace the # sign in those images to %23 instead. The sharp sign won't work in IE

# December 11, 2007 8:23 AM

Mike said:

Is it just me, or are the screen shots not coming through?  The last two tips have not had images.  Clicking on the image takes me to a page that says the image isn't found.

http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.Howtochangedefaultvaluesandvariables_9E2C/CodeSnippetsC#_2.jpg

# December 11, 2007 3:06 PM

saraford said:

Hmm, this is not good.  I'll investigate tonight what is going on with the screen shots.  

# December 11, 2007 3:43 PM

saraford said:

or i could just read Dennis's comment above!  =)

As soon as I get a free second, i'll update the images.  I was worried for a second there.

# December 11, 2007 3:46 PM

saraford said:

Okay, all of the images are fixed now, including the ones for the rest of the week.  Thanks!

# December 11, 2007 5:51 PM

Секреты Visual Studio said:

Когда вы вставляете шаблон кода, редактор подсвечивает поля (переменные, значения и т.п.), которые вы

# March 19, 2009 2:55 AM
New Comments to this post are disabled
Page view tracker