ISerialized .Net, C#, Scrum and agile software development

14Dec/092

Adding C# and ASP.Net code to Blogger

Many developers ask, how can I paste C# code in my blog? I have looked into several ways of doing this, my verdict: Use Windows Live Writer!

Update: Please see my second blog post about an updated evaluation of Blogger and C# ASP.Net

Windows Live Writer comes with Live Messenger, and has a very easy to use interface, and is easily connected with your blog. In addition to Live Writer, you need an additional plug-in called Paste From Visual Studio.
So copy your code in Visual Studio, go to Live Writer and press Paste From Visual Studio, and your code is added with highlighting!
Adding the CollectionExtensionsFixture class from Microsoft Patterns & Practices i get:

// Microsoft patterns & practices// Composite Application Guidance for Windows Presentation Foundation and Silverlight// Copyright (c) Microsoft Corporation.  All rights reserved.// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND// FITNESS FOR A PARTICULAR PURPOSE.// The example companies, organizations, products, domain names,// e-mail addresses, logos, people, places, and events depicted// herein are fictitious.  No association with any real company,// organization, product, domain name, email address, logo, person,// places, or events is intended or should be inferred.using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.Linq;using System.Text;using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.Practices.Composite.Tests{[TestClass]public class CollectionExtensionsFixture{[TestMethod]public void CanAddRangeToCollection(){Collection<object> col = new Collection<object>();List<object> itemsToAdd = new List<object>{"1", "2"};

col.AddRange(itemsToAdd);

Assert.AreEqual(2, col.Count);Assert.AreEqual("1", col[0]);Assert.AreEqual("2", col[1]);}}}

 

Posted by Pål Eie

Comments (2) Trackbacks (0)
  1. hi,

    First of all. Thanks very much for your useful post.

    I just came across your blog and wanted to drop you a note telling you how impressed I

    was with the information you have posted here.

    Please let me introduce you some info related to this post and I hope that it is useful

    for .Net community.

    There is a good C# resource site, Have alook

    http://www.csharptalk.com

    simi

  2. Hi Simi!
    I am really glad you like my blog! I will definitely take a look at CSharpTalk!


Leave a comment

No trackbacks yet.