I’ve developed quite a few extensions working with the ASP.Net MVC framework ( don’t worry, I’ll roll them out as I clean them up and make the more useful for mass-consumption ).  I almost always need to inject some javascript into the page in these extensions, and I’ve found literal strings ( using @ before a string ) to be quite handy for development.

For example, imagine a script block similar to the following:

<script type="text/javascript">
    $('#divToShow').show();
    $('#divToHide').hide();
</script>

Without using string literals, you’ll need to do something like the following:

"<script type=\"text/javascript\">" + Environment.NewLine +
" $('#divToShow).show();" + Environment.NewLine +
" $('#divToHide).hide();" + Environment.NewLine +
"</script>"

Using string literals:
 
@"<script type=""text/javascript"">
$('#divToShow').hide();
$('#divToHide').show();
</script>"

Much cleaner!
 
It may look subtle, but using string literals throughout the development of my extensions has made things much easier to enhance, refine, and (gasp!) debug.
 
What do you think?
 
- Colin