Source Code Readability Tips

I was reading the article Source Code Readability Tips and saw the code


var min = Int32.MaxValue;


By looking at var, is this var an int? Is this var an Int32 or something else?


So I think if you do the following will be more readable.


int min = Int32.MaxValue;




Int32 min = Int32.MaxValue;


Unless you think int is not an int, and Int32 is not an Int32.

Posted in .Net | Tagged , | Leave a comment

Working ASP.NET sample for VS 14 CTP 4 TailspinSpyworks

Beside those sample applications I blog in the articles

The TailspinSpyworks is another application that you can run in VS 14 CTP 4 and it has been working since Visual Studio 2010 for me.

The only trick that I always need to do is attach the database to the MS SQL Server. For this case I am using MS SQL Server 2012.

The original connection string is

<add name=CommerceEntities connectionString=metadata=res://*/Data_Access.EDM_Commerce.csdl|res://*/Data_Access.EDM_Commerce.ssdl|res://*/Data_Access.EDM_Commerce.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Commerce.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot; providerName=System.Data.EntityClient />

Change it to

<add name=CommerceEntities connectionString=metadata=res://*/Data_Access.EDM_Commerce.csdl|res://*/Data_Access.EDM_Commerce.ssdl|res://*/Data_Access.EDM_Commerce.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;initial catalog=commerce;Integrated Security=True;MultipleActiveResultSets=True&quot; providerName=System.Data.EntityClient />

This should work for you.


Posted in .Net | Tagged , , , | Leave a comment

Write XML Tree to XML file (LINQ to XML) with sub child

In my article Write XML Tree to XML file (LINQ to XML) the XElement tree only has on level. In this sample, I added another level to the tree.

  class Program


    static void Main(string[] args)


      XmlWriter xw = XmlWriter.Create(“output.xml”);

      // Create a tree with a child element.

      XElement xmlTree1 = new XElement(“Root”,

          new XElement(“Child1″, 1)



      XElement xmlTreeSub1 = new XElement(“Child1″,

        new XElement(“SubClihd”, 3)



      // Create an element that is not parented.

      XElement child2 = new XElement(“Child2″, 2);


      // Create a tree and add Child1 and Child2 to it.

      XElement xmlTree2 = new XElement(“Root”,






      // Compare Child1 identity.

      Console.WriteLine(“Child1 was {0}”,

          xmlTree1.Element(“Child1″) == xmlTree2.Element(“Child1″) ?

          “attached” : “cloned”);


      // Compare Child2 identity.

      Console.WriteLine(“Child2 was {0}”,

          child2 == xmlTree2.Element(“Child2″) ?

          “attached” : “cloned”);







You can also download a single solution from The sample file name is My MSN ID is

Posted in .Net | Tagged , , | 2 Comments

Free ebook: Creating Mobile Apps with Xamarin.Forms, Preview Edition

Download the free book from

Remember, Xamarin is not a free tool even the book is free.

Posted in .Net | Tagged , , , | Leave a comment

7-zip or Winrar

In layman term, I have a folder with 4.76 GB, 19,875 files, and 3,803 folders. Using 7-zip version 9.2 I zipped into 2.2 GB. Using Winrar 5.11 I zipped into 2 GB.

Will I choose 7-zip or Winrar? Well, it depends. 7-zip can edit a file without unzip it somehow I don’t think Winrar has that feature.




Posted in .Net | Tagged , , , | Leave a comment

Bing Map SDK for Windows 8.1 will not work for VS 14 CTP 4

Don’t spend your time if you are thinking to run Bing Map in VS 14 CTP 4 at this moment.


Posted in .Net | Tagged , | Leave a comment

ASP.NET samples that run in Visual Studio 14 CTP 4

So far I have tried 3 samples. I am running Visual Studio 14 CTP 4 in Windows 10.

1. The Wingtip Toys run without doing anything

2. Bug Tracker you need to change the .NET Framework to 4.5.3 Core.

3. MVC Music Store I am not able to make it work for 1 hour. Maybe you can.

Posted in .Net | Tagged , , , , | 1 Comment