Displaying C# code in Wordpress.com Displaying C# code in Wordpress.com wordpress wordpress

Displaying C# code in Wordpress.com


Just edit your aricles in html mode and enclose your code within these tags.

[sourcecode language="css"][/sourcecode]

Example:

[sourcecode language="javascript"] // javascript hello world program alert('Hello, World !!');[/sourcecode]

Note: You need to specify correct language identifier for the language attribute as shown above.

More Information Here :)


The [sourcecode] tag usually works fine for C#, but for me it often breaks when I post XAML code.

Instead I use this page to format my code. The result looks nice (you can see it on my blog), but it requires the "Custom CSS" option ($15/year).


EDIT: actually the [sourcecode] tag works fine, and I'm now using it in all my posts


    [code language="csharp"]       //Your code here    [/code]