OK. So U want to share code on a blog... This is actually typical case. Of course you want your code to have proper indentation, and probably syntax coloring. There's excellent piece of a free software that can help U with this - CopySourceAsHtml (CSAH) plugin for VS 2008. U can find it here. It's usage is as simple as selecting desired code, hitting right mouse click and selecting Copy As HTML... And this is how a typical C# hello world application looks like using formatting from this tool:
20 ///
21 /// Some remarks :)
22 ///
23 public class SomeClass
24 {
25 public const string MyString = "I'm a constant!";
26
27 private static void Main(string[] args)
28 {
29 Console.WriteLine(MyString);
30 }
31 }
There's a one problem, however. This tool does not work with XAML or more generally with any XML code at all! Hope support will be added ASAP.
Enjoy!
You can also use Windows Live Writer + Paste from Visual Studio plugin
ReplyDelete