The Default C# Code

The New Project wizard also created a source file, Program.cs, whose contents have been reproduced in Example 3-1.

Example 3-1. Default code generated by the New Project wizard.

using System;
using Microsoft.SPOT;
namespace HelloMicroFramework
{
   public class Program
   {
      public static void Main()
      {
         Debug.Print(
            Resources.GetString(Resources.StringResources.String1));
      }
   }
}

The first thing to notice is the inclusion of the libraries this code relies on through the use of the C# keyword using.

using System;
using Microsoft.SPOT;

This is similar to the C or C++ #include preprocessor directive and simply makes available the definitions contained in the referenced libraries to your code (and, more conveniently for us programmers, the productivity-enhancing ...

Get Embedded Programming with the Microsoft® .NET Micro Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.