Visual Studio code selection as HML

I was looking for a possibility to copy selected Visual Studio code as HTML to publish code easily.

I am using Windows Live Writer and WordPress. There is a plugin called "Paste As Visual Studio Code".

Here you can download this plugin.

Install this plugin, start Windows Live Writer, copy some code from Visual Studio IDE, switch to tab “Insert” and paste it into an Windows Live Writer article clicking the plugin button.

pasteasvisualstudiocode

Outputdebugstring in .NET / Visual Studio / C# / WPF

In my old Delphi developer days I used OutputDebugString() to track problems or elapsed time.
In .NET you can use the System.Diagnostics.Debug class.

You have to run the project in debug mode.

Code Snippet
  1. private void ReadFirstFile(string filename1)
  2. {
  3.     StatusText = "Reading file 1";
  4.     Stopwatch watch = new Stopwatch();
  5.     watch.Start();
  6.     using (StreamReader file1 = new StreamReader(filename1))
  7.     {
  8.         while (!file1.EndOfStream)
  9.         {
  10.             sc1.Add(file1.ReadLine());
  11.         }
  12.     }
  13.     watch.Stop();
  14.     System.Diagnostics.Debug.WriteLine("Time spent reading file 1: " + watch.Elapsed);
  15. }

MSDN link: http://msdn.microsoft.com/en-us/library/6x31ezs1.aspx

Enable automatic checks of documentation comments

If you want the C# compiler to check the documentation comments automatically you have to enable xml documentation file in the build settings of your project.

So the compiler reports errors in your documenation.

vs_xmldocumentation1

Default build settings

vs_xmldocumentation2

Build settings with enabled XML documentation file

vs_xmldocumentation3

The compliler reports documentation errors.