TweetFollow Us on Twitter

An Initial Look at the .NET Platform

Volume Number: 19 (2003)
Issue Number: 10
Column Tag: Programming

Casting Your .NET

An Initial Look at the .NET Platform

by Andrew Troelsen

Exploring .NET development on Mac OS X

Welcome, Skeptical Readers...

Building raw application infrastructure by hand is a time consuming, error prone and painful process. Who among us really wants to create yet another linked list, database access framework or user interface library? Thankfully, numerous platform development kits exist today. By leveraging APIs (application programming interfaces) such as J2SE/J2EE, Cocoa, and Carbon we are able to keep focused on the programming task at hand by leveraging a set of canned functionality.

As a software professional the chances are good that you are aware of a new development platform created by Microsoft named .NET (pronounced, dot net). As well, you may have also heard of a plethora of new programming languages that target this new framework such as C# (see sharp), Visual Basic.NET, managed C++ and Pascal.NET (to name a few). However, given .NET's point of origin (Microsoft), you may have naturally assumed that .NET development is solely the activity of Windows programmers. If you did make this assumption, you might be quite surprised to learn that C# and the .NET platform are alive and well under Mac OS X, as well as other Unix-based systems.

In this new MacTech series, it is my goal to provide a guided tour of the .NET platform as seen through the eyes of a Macintosh developer. Over the articles to come, you will learn how to configure your development machine(s) with the necessary infrastructure required to build various types of .NET applications using multiple .NET distributions and .NET-aware programming languages.

To begin our journey however, we need to gain a high-level perspective of .NET itself, which is the point of this first article. Please be very aware that all of the topics examined here will be further explained and expanded upon in subsequent articles. Given this friendly disclaimer, kick back with your beverage of choice and let's get to know the .NET platform.

The Philosophy of the .NET Platform

The .NET platform is a software development API that was officially released to the programming world circa 2001. Despite the name (which tends to conjure up visions of Web-enabled front ends), the .NET platform can be used to build traditional desktop applications, Terminal applications as well as server-side Web applications and XML Web services.

Like other frameworks, .NET provides a class library that allows developers to build various forms of applications. Not only does this base class library encapsulate various primitives such as threads, object serialization services, file IO, and interaction with various hardware devices (such as printers and handheld devices), but it also provides support for a number of services required by most real world applications (e.g. GUI toolkits, XML manipulation, network protocols and so forth).

However, unlike many other frameworks, the .NET base class libraries may be accessed using numerous programming languages. Not only can developers pick their programming language of choice when building .NET solutions, but they may also create a single .NET application using multiple languages. For example, you could make use of C# to build a desktop application which communicates with a XML Web services written using Visual Basic.NET. Even more interestingly, .NET supports cross-language inheritance, cross-language exception handling and cross-language interface implementation. Given these traits, you will do well to view .NET as a language-agnostic framework.

In addition to being a language-agnostic development platform, .NET is also platform-agnostic. This tidbit is the one aspect of .NET that tends to surprise most developers. While it is true that Microsoft Corporation has never been in the business of building software that can (easily) run of multiple operating systems, the tides have turned with the release of the .NET platform. Like J2SE, the .NET platform allows you to build software that can execute on multiple operating systems without modification. Therefore, if you build a .NET-based program on your Macintosh G5, you are able distribute and execute this application on any operating system hosting the .NET runtime.

The Building Blocks of .NET

Clearly, a language and platform neutral platform such as .NET is founded upon a number of well-defined rules and underlying technologies. Given this, our next task is to preview (the operative word being preview) some key and interrelated specifications that make it all possible: the Common Language Infrastructure, the Common Type System and the Common Language Specification.

The Common Language Infrastructure (CLI)

First up, we have a specification termed the Common Language Infrastructure, or simply CLI. This particular aspect of .NET is the foundation upon which the platform and language independent nature of .NET is established. The CLI is a fairly large specification that formalizes several critical elements of the platform, including:

  • An abstract runtime engine termed the Virtual Execution System (VES), which is capable of hosting .NET compliant code libraries.

  • The internal structure of the .NET compliant code libraries (which go by the name assemblies) to be hosted by the VES.

  • A unified type system termed the Common Type System (CTS), which describes the rules used to compose the programming types contained within .NET assemblies.

  • The syntax and semantics of the low-level language used to implement the types contained within .NET assemblies, termed the Common Intermediate Language (CIL).

The VES is a hypothetical execution engine that sits on top of the actual underlying operating system (such as Mac OS X or Windows XP). The primary role of the VES is to locate, load, execute and manage .NET code libraries (a.k.a. assemblies) on your behalf. As well, the VES takes care of a number of related details such as automatic memory management (via garbage collection), language integration, ensuring type safety and verifying the correctness of the assembly's CIL code (more on CIL a bit later in this article).

One a related note, if you do have some experience using Microsoft's official .NET platform, you may have heard of another term: the Common Language Runtime (CLR). Basically, the CLR is the formal name given to a VES implementation that is specific to the Windows family of operating systems. Given that we are not all that interested in the Windows-centric implementation of the CLI's execution engine, I'll stick to the more generic term 'VES' when referring to the execution engine of .NET.

The Common Type System (CTS)

The next building block of the .NET platform, the Common Type System, or CTS, is concerned with formalizing the structure of the types contained within the code libraries themselves. Simply put, the CTS specifies all of the possible data types (e.g. Booleans, strings, integers, etc) and programming constructs (e.g., iteration constructs, virtual methods, overloaded operators, type constructors and so on) supported by the .NET runtime.

One of the most fundamental rules of the CTS is the fact that every .NET type derives from a common base class named System.Object. For your edification, Listing 1 shows the C# definition of this top-most class type:

Listing 1: The C# definition of the ultimate .NET base class

namespace System
{
   public class Object
   {
     public Object();
       public virtual Boolean Equals(Object obj);
       public virtual Int32 GetHashCode();
       public Type GetType();
     public virtual String ToString();
     protected virtual void Finalize();
     protected Object MemberwiseClone();
  } 
} 

At this point in the game, don't worry if you cannot make heads or tails of previous code listing. The point here is that the CTS is the aspect of the CLI that describes a set of rules that constitute a well-defined .NET type, one such rule being the fact that System.Object is the cosmic super class. As you would hope, other rules of the CTS and the role of System.Object (not to mention the C# programming language) will be examined in great detail at a later time.

The Common Language Specification (CLS)

Understand that a particular .NET language (such as COBOL.NET) is not required to support each and every aspect formalized by the CTS. For example, although the CTS does define how unsigned data types are to be represented in CIL and processed by the runtime engine, not all .NET languages support unsigned data. Given that .NET is a language-neutral platform, it would be quite helpful to have a well-defined baseline of functionality. The Common Language Specification (CLS) is effectively a subset of the CTS, which defines a set of data types and programming constructs that all .NET languages can agree upon.

When you build .NET assemblies that only makes use of the guidelines expressed by the CLS, you can rest assured that your code library can be correctly used by any .NET language (such code is termed 'CLS compliant'). On the other hand, if you build a .NET code library that makes use of features outside the realm of the CLS (but within the confines of the CTS), you have just created an assembly that may only be completely usable from select .NET programming languages.

To solidify the concepts presented thus far, figure 1 illustrates how various .NET programming languages ultimately target the VES and CTS/CLS specifications.


Figure 1. .NET programming languages target the .NET platform, which is built upon numerous specifications.

Now that you have a better idea regarding the role of the CLI, let's dig into some further details of the .NET type system.

The Type System of .NET

Every programming language (and therefore every programming platform) exposes a 'type system'. This term boils down to the set of syntactically well-formed user defined types (UDTs) supported by said language (or platform). To illustrate a well-know type system, consider Java. As of Java 1.4, the type system consists of class types and interface types. Beginning with Java 1.5, the type system will be expanded to include C-style enumerations. In a similar vein, the C++ programming language supports a type system consisting of the set {class, enumeration, structure}, with interfaces being simulated via class types and a corresponding typedef or two.

.NET also defines a set of possible types, which have you have seen is officially termed the CTS. As you would expect from a modern day API, this type system is extremely well organized and completely object oriented (including support for a relatively new programming paradigm termed aspect oriented programming).

To illustrate the symmetry of the .NET type system, ponder the fact that every single UDTs provided by the .NET platform, including any custom software entities you create yourself, will fall into one of the following categories:

  • Class

  • Interface

  • Structure

  • Enumeration

  • Delegate

While these type categories will be fully explained in later articles, Table 1 offers high-level definitions for each member of the .NET type system.

.NET Type         Meaning in Life

Class             Class types are heap allocated entities that may be extended and modified by 
                  derived classes.  .NET classes are very similar to Java, C++ and Objective C 
                  class types. As you know, classes form the basis of the famed 'pillars of OOP' 
                  (encapsulation, inheritance and polymorphism).
                  
Interface         An interface is a collection of abstract members grouped by a particular name.  
                  Using interfaces, developers are able to establish polymorphism between types not 
                  related by classical inheritance.
                  
Structure         Structures are lightweight, stack-allocated entities that are well suited for 
                  modeling numeric, geometric and atomic user defined types.
                  
Enumeration       Enumerations (or simply, enums) are a named collection of name/value pairs.

Delegate          By far and away, .NET delegates are the most confounding 'type of type' to contend 
                  with.  For now I will simply define .NET delegates as nothing more than a type-safe 
                  and object oriented function pointer (more details to come in later articles).

Table 1. The .NET type system

Given that .NET provides many thousands of predefined types (collectively termed the 'base class libraries' or simply BCL), you will be happy to know that like-minded types are organized into a conceptual boundary termed a namespace.

Understanding .NET Namespaces

The namespace concept is not new. The Java, C++ and Smalltalk languages have used similar (but not identical) concepts to partition types for years. In a nutshell, a .NET namespace is a collection of semantically related types. For example, the System.Collections namespace contains a set of classes, interfaces, enumerations, structures and delegates that represent 'types that manage other types' (e.g. linked lists, array lists, FILO / FIFO types and so on). The System.Data namespace defines numerous types that have to do with database manipulations. Table 2 documents some (but by no means all) interesting .NET namespaces.

.NET namespace   Meaning in Life

System                      The System namespace defines various core types you will use on a 
                            day-to-day basis.  Here you will find the native .NET data types, core 
                            exceptions and numerous utility types.\
                            
System.Collections          As mentioned, this namespace defines types that can contain and manage 
                            other types (e.g. ArrayList, Stack, Queue and so on).
                            
System.Data                 The .NET platform defines numerous data-centric namespaces that allow you 
                            to interact with various relational databases. System.Data is the lowest 
                            common denominator for data access under .NET.
                            
System.Drawing              The drawing-centric namespaces allow you to render graphical data to a 
                            surface (such as window of a desktop application or a region of memory).
                            
System.IO                   Defines types to work with various input/output streams. 

System.Reflection           The reflection namespaces allow you to programmatically discover the 
                            functionality of types (as well as generate new types) at runtime.
                            
System.Runtime.Remoting     .NET defines numerous namespaces which allow you to build distributed 
                            applications. 
                            
System.Web                  The Web-centric namespaces allow you to build Web-based applications 
                            (ASP.NET) and XML Web services.
                            
System.Windows.Forms        Windows Forms provides types that allow you to build traditional desktop 
                            applications. 
                            
System.Xml                  As you would hope, the .NET platform defines numerous namespaces that 
                            facilitate the manipulation of XML data.  

Table 2. A sampling of .NET namespaces.

Interacting with the Base Class Libraries

Regardless of which sort of application you intend to build, you will inevitably interact with numerous .NET namespaces. However, the way you programmatically denote the namespace you wish to consume will differ based upon your .NET programming language of choice. If you are using C#, you would make use of the using keyword to specify the namespaces you wish to use. For example consider Listing 2:

Listing 2: Specifying namespaces in C#

// My way cool C# program.
using System;
using System.Windows.Forms;
using System.Drawing;
public class MyApp
{
    // ToDo: Add some interesting code... 
}

On the other hand, if you would rather build your application using Visual Basic.NET, you use the Imports keyword to achieve the same affect, as seen in Listing 3:

Listing 3: Specifying namespaces in VB.NET

' My way cool Visual Basic.NET program.
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Public Class MyApp
  ' ToDo: Add some interesting code...
End Class

In either case, once you declare the namespaces you wish to consume, you are now able to access each of the types defined within the System, System.Windows.Forms and System.Drawing namespaces.

The Fully Qualified Name of a Type

It is worth pointing out that explicitly specifying the namespaces you wish to interact with using a language specific keyword is technically optional. To understand why this is the case, allow me to define the term fully qualified name. As you have already seen, all .NET types live within a namespace definition. Thus, if you wish to make use of the ArrayList type defined in the System.Collections namespace, you might author the following C# code (Listing 4):

Listing 4: Using the ArrayList type via namespace references

using System.Collections;
public class MyClass
{
  public void SomeMethod()
  {
          // Add some data to an ArrayList.
    ArrayList arList = new ArrayList();
    arList.Add(12);
    arList.Add("Don't forget wife's birthday");
  }
}

While you will typically always prefer to explicitly list the namespaces used by a given source code file, the previous code is nothing more than a short hand notation for the following code in Listing 5 (note the lack of a C# using statement):

Listing 5: Using ArrayList via the fully qualified name

public class MyClass
{
  public void SomeMethod()
  {
          // Add some data to an ArrayList.
    System.Collections.ArrayList arList 
      = new System.Collections.ArrayList();
    arList.Add(12);
    arList.Add("Don't forget wife's birthday");
  }
}

As you can gather, the fully qualified name of a type is simply a term used to identify a type prefixed by its defining namespace. While making use of fully qualified names may make your code painfully well documented, hand cramps are sure to follow. Given this, most programmers prefer to list the set of namespaces used by a given file using a language specific keyword.

In terms of performance, there is absolutely no difference whatsoever between identifying a type with the fully qualified name or via a namespace reference. As you will see in just a bit, the .NET platform always refers to a type using its fully qualified name. In this light, the namespace concept is simply a typing time saver.

If you have a background in the J2SE platform, understand that the C# using and VB.NET Imports keyword do not support a Java-style * notation. If you wish to access nested namespaces, you must list out each nested namespace in turn. Thus, the following C# code is syntactically correct (Listing 6):

Listing 6: Nested namespaces must be listed explicitly

// Making use of three drawing related namespaces.
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

While the following Java-like notation (Listing 7) will cause a compiler error issued by the C# compiler:

Listing 7: Java-like * syntax not supported in C#!

//Oops!  Remember, C# is not Java!
using System.Drawing.*; 

Creating Custom .NET Namespaces

In addition to programming with the namespaces defined by the .NET base class libraries, you may define your own custom namespaces as well. By way of a simple example, assume you have defined two class types and one enumeration. To group these items into a namespace definition, you could write the following C# code (Listing 8):

Listing 8: Namespaces contain any number of .NET types

namespace MyCustomTypes
{
  public class MyClass {...}
  public class MyOtherClass {...}
  public enum MyEnum {...}
}

The corresponding VB.NET code example is quite similar (Listing 9):

Listing 9: Ditto.

Namespace MyCustomType
  Public Class MyClass
  ...
  End Class
  Public Class MyOtherClass
  ...
  End Class
  Public Enum MyEnum
  ...
  End Enum
End Namespace

If you wish to use these types from another namespace, you would simply make use of the correct language specific keyword used to reference an external namespace. For example, in C# we would write the following (Listing 10):

Listing 10: Referencing a custom namespace in C#

using MyCustomTypes;
namespace MyNewNamespace
{
  public class MyNewClass
  {  
        // You can now make use of any of the types in 
        // the MyCustomTypes namespace
  }
}

So much for our initial high-level overview of the .NET type system. At this point in the game simply understand that the .NET type system consists of the set {class, interface, enumeration, structure, delegate} and that semantically related types are grouped together using the namespace concept. Next up, let's check out further details regarding the language agnostic nature of the .NET platform.

.NET is a Language Agnostic Platform

As mentioned, one distinguishing aspect of the .NET platform is the fact that developers may make use of any combination of programming languages to access the types of the base class libraries. Microsoft itself has created five .NET-aware programming languages: C#, J#, VB.NET, managed C++ and JScript.NET. While C# and VB.NET tend to steal most of the spotlight, there are literally dozens of languages which can be used to interact with the .NET libraries. Consider the partial list offered by Table 3 (please note that the exact URLs are subject to change in the future).

.NET Aware Programming Language              Meaning in Life  

Component Pascal                             Pascal language bindings for.NET
http://www.citi.qut.edu.au/research      
/plas/projects/index.jsp . 

Eiffel                                       Eiffel language bindings for .NET.
http://archive.eiffel.com/doc/manuals/      
technology/dotnet/eiffelsharp 

Fortran                                      Fortran language
http://www.lahey.com/lf70/lf70.htm           bindings for .NET.

Perl and Python                              Perl and Python to .NET language bindings are also 
http://aspn.activestate.com/ASPN/NET         available.
               
Scheme                                       The Scheme language is supported under the .NET 
http://rover.cs.nwu.edu/~scheme              platform as well.
               
SmallScript (a.k.a., S#)                     Yes, even Smalltalk supports binding to the 
http://www.smallscript.net                   .NET platform.

Table 3. A partial listing of .NET aware programming languages

When developer's first learn about the language agnostic aspect of the .NET platform, various questions tend to surface. One such question is more practical in nature, and tends to go something like this: "If all languages targeting .NET have access to the same libraries, why do we need more than one language?" The corresponding practical answer is based on the simple fact that programmers tend to be very particular which their syntactic preferences (myself included).

Some developers love to see curly brackets and semi-colons galore (as seen in C-based languages such as Objective C, C++ and Java). Others prefer more 'human-readable' syntactic tokens as found in the BASIC family of languages. Given the philosophy of .NET, we area able to stay true to our syntactic preferences while accessing the .NET base class libraries.

Furthermore, remember the obvious fact that each programming language has its own set of strengths and weaknesses. Some languages have excellent native support for advanced mathematical processing, while others excel in the realms of financial or logical processing. Again, using .NET you can capitalize upon the unique aspects of a given language while interacting with the fabric provided by the .NET base class libraries.

The Role of .NET Assemblies

Obviously, knowing how to develop with a particular .NET programming language (or two) is only part of the process. Once you have authored your .NET source code files that define your namespaces and their contained types, they are fed into the related complier to produce a binary file termed an assembly. Assemblies are platform-neutral binaries blobs that contain generic descriptions of types and their implementation that are hosted by the VES. To be more specific, a .NET assembly is a unit of deployment that is composed of the following three ingredients:

  • Common Intermediate Language (CIL)

  • Type metadata

  • Assembly-level metadata (termed the manifest)

Again, later articles will drill into the details of .NET assemblies, CIL code and metadata. However to prime the pump, let's see a simple example which illustrates the basic composition of a .NET assembly. Assume we have the following C# source code file seen in Listing 11 (note that by convention, C# code files end in a *.cs file extension):

Listing 11: A trivial .NET source code file (in C#)

// MyCSharpApp.cs
using System;
namespace AllMyStuff
{
  public class MyCSharpApp
  {
    public void EchoToTerminal(string message)
    {
      Console.WriteLine("You said: {0}", 
        message);
    }
  }
}

Even if you have never seen C# code before this article, the previous code example should not raise too many eyebrows. Here we see a class type with a single method named EchoToTerminal(), which takes a string type as its only parameter. This method is implemented to take the incoming argument and print the contents to the Macintosh Terminal. Notice that the WriteLine() method of the System.Console type takes a literal string argument containing an optional (and strange) token {0}, which is dynamically replaced by the specified second argument. For the time being, simply regard this notation as a kinder, simpler version of the C printf() function.

Once this source code file has been processed by the C# compiler, we end up with an assembly, which for the sake of argument, we will name MyCSharpApp.dll. Although the file extension of a .NET assembly can technically be anything you choose, you are likely to find two common extensions in use today. If you have a .NET assembly ending in the extension *.exe, you are looking at an executable program that can be directly loaded by the VES. On the other hand, assemblies which end with a *.dll file extension are dynamic link libraries which cannot run in and of themselves. Rather, *.dll files are loaded on demand my other running applications (very similar to the *.dylib modules found under Mac OS X).

The Guts of a .NET Assembly

As you will see in the next article, .NET distributions ship with a tool named ildasm (the CIL disassembler) which can be used to view the underlying CIL code, type metadata and assembly manifest contained within a given .NET assembly. For our current discussion, we are only concerned with the internal representation of the EchoToTerminal() member, as seen in Listing 12:

Listing 12: EchoToTerminal() expressed in CIL code

.method public hidebysig 
 instance void EchoToTerminal
 (class System.String message) cil managed 
{
  .maxstack  8
  ldstr "You said: {0}"
  call void [mscorlib]
   System.Console::WriteLine(class System.String)
  ret
}

Without getting too bogged down into the details at this point, simply notice how the C# implementation of EchoToTerminal() has been processed by the C# compiler into terms of CIL code. As you may have already guessed, the ldstr CIL operational code loads a string for use, while call is used to invoke a type member (in this case, the WriteLine() method of System.Console) with the currently loaded arguments. Finally, the ret operational code is the CIL-savvy way to return from a method.

Now assume we have implemented the same exact class type using VB.NET as shown in Listing 13 (by convention, VB.NET source code files end with a *.vb file extension):

Listing 13: A trivial .NET source code file (in VB.NET)

'MyVbNetApp.vb
Imports System
Namespace AllMyStuff
  Public Class MyVbNetClass
    Public Sub EchoToTerminal(message as String)
      Console.WriteLine("You said: {0}", message)
    End Sub
  End Class
End Namespace

Once this source code file is processed by the VB.NET compiler, we can again use ildasm to view the resulting CIL generated by the VB.NET compiler (Listing 14):

Listing 14: EchoToTerminal() expressed in CIL code (yet again)

.method public hidebysig 
 instance void EchoToTerminal
 (class System.String message) cil managed 
{
  .maxstack  8
  ldstr "You said: {0}"
  ldarg.1
  call void 
  [mscorlib]System.Console::WriteLine(
  class System.String, class System.Object)
  ret
}

As you have just seen, regardless of the fact that different .NET-aware programming languages define unique keywords and programming idioms, the associated compiler transforms these tokens into a common language (CIL) which is injected into the binary assembly. While it is true that individual .NET code compilers are free to take some liberties regarding the transformation of their syntactic tokens into CIL, the fact remains that as far as the .NET runtime is concerned, CIL is the only language worth speaking and the only true language processed by the .NET runtime engine.

To wrap things up for this first article, we close with a further examination regarding the platform-agnostic nature of the .NET platform.

.NET is a Platform Agnostic Platform

Having a language-agnostic .NET assembly does little good to anyone unless it can be loaded, executed and processed by a runtime engine. As noted earlier in this article, the Virtual Execution System (VES) is the entity in charge of hosting a valid .NET assembly. In addition to being a language-agnostic platform, .NET is also platform-agonistic. If you have any experience with anything related to Microsoft, this last statement is sure to resonate as a flat out lie. However, as strange as it may seem, while Microsoft was developing their official .NET distribution, a team of engineers created an alternative implementation of the CLI (termed the Shared Source CLI) that may be compiled and run on numerous operating systems (including of course, Mac OS X).

Although this article has provided a high-level examination of select elements defined by the CLI, the official documents are available in Microsoft Word format at http://msdn.microsoft.com/net/ecma/. If you would rather obtain the PDF versions of these same documents, navigate to http://www.ecma-international.org/publications/standards and locate the following two documents:

ECMA-334: The formal specification of the C# programming language.

ECMA-335: The formal specification of the .NET CLI.

Yes, it's true. The Microsoft CLI documents have been submitted to ECMA as an official standard. In fact, the CLI was developed in conjunction with a number of key industry players (such as Intel and IBM).

ECMA-334 defines the syntax and semantics of C#. While I certainly encourage you to obtain and read this document, do be aware this is a rather academic treatment of the subject. Keep it handy for a rainy evening or a sleepless night, however do know that you will come to know the details of the C# programming language over the course of the articles to come.

ECMA-335 is a very critical document for all of those interested in understanding how the .NET platform can be ported to different operating systems. As well, this information is also quite helpful for tool builders who wish to build compilers for languages that target the .NET platform or geeks like us who are interested in technology.

Given that ECMA-335 is quite lengthy, it has been subdivided into a set of partitions, which is simply a fancy and overly verbose way of saying sections. Table 4 explains the content found within these partition documents.

Partition of the ECMA-335 Document   Meaning in Life

Partition I Architecture             Describes the overall architecture of the CLI, including the 
                                     rules of the CLS, the .NET type system (CTS), and the virtual 
                                     execution system (VES).  
                                     
Partition II Metadata                Describes how .NET types (and their members) are to be 
                                     represented in terms of .NET metadata.   
                                     
Partition III CIL                    This document describes all of the gory details of the Common 
                                     Intermediate Language (CIL).    
                                     
Partition IV Library                 Gives a high level overview of the minimal and complete class 
                                     libraries that must be supported in a .NET distribution.   
                                     
Partition V Annexes                  A collection of 'odds and ends' that describe class library 
                                     design guidelines, as well as the implementation of ilasm (the 
                                     CIL assembler utility).  

Table 4. A breakdown of the ECMA-335 specification.

Always remember that at its core, the CLI is effectively little more than a set of white papers. All of the specifications set forth in these standards documents are of little practical use until they are given life in terms of a physical code base. To date, there are many implementations of the standards defined by the CLI. Some of these CLI distributions have indeed come from Microsoft proper, which as noted, are rather Windows-centric in that they leverage certain aspects of the Win32 operating system that are simply not found on other systems.

Lucky for us, there are a number of additional CLI distributions that have no ties to Microsoft (or the Win32 APIs) beyond the fact that the original specifications have been consulted as a foundation. Two of the most popular open source distributions of the CLI go by the names Portable .NET and Mono. Table 5 describes the most well known distributions of the CLI.

.NET Platform Distributions               Meaning in Life  
The Microsoft .NET Platform               This is the commercial CLI implementation offered by 
                                          Microsoft, which is geared for use by the Windows family 
                                          of operating systems.   
                                          
The Microsoft .NET Compact Framework      A stripped down version of the official MS .NET platform 
                                          that targets handheld computer devices (such as mobile 
                                          phones and Pocket PCs).
                                          
The Microsoft Shared Source CLI (SSCLI)   While this implementation of the CLI has come from 
http://msdn.microsoft.com/net/sscli       Microsoft, thecode base is platform natural.  This 
                                          distribution is more geared towards R&D efforts and 
                                          tinkering and is not intended to be a full-fledged 
                                          development platform.
                                          
Portable .NET                             This is an open source CLI implementation that intends 
www.dotgnu.org                            to account for all of the functionality found in the 
                                          commercial Microsoft .NET platform (in addition to 
                                          Unix-specific APIs).  
                                          
Mono                                      Another open source CLI implementation that also intends 
www.go-mono-org                           to compete with the commercial Microsoft .NET platform 
                                          (also in addition to Unix-specific APIs).        

Table 5. Various distributions of the .NET Platform

Again, given that you are reading MacTech (as opposed to Windows Developers Journal) I will not spend much time at all talking about the official Microsoft .NET distributions. Over the next several articles to come, we will come to know the SSCLI. As you will see, the SSCLI is a research-focused distribution of the CLI that is a great first step for Macintosh developers interested in checking out the .NET platform and the C# programming language.

While this particular CLI distribution does not provide an implementation of GUI based toolkits (such as Windows Forms or ASP.NET), it does provide a wealth of technical information that will build your .NET muscle. As you examine the SSCLI, you will become familiar with .NET namespaces found on any CLI distributions.

Later articles will build upon your exploration of the SSCLI by examining the Portable .NET and Mono open source projects. These CLI distributions not only provide an implementation of ADO.NET, ASP.NET and Windows Forms, but ship with compilers which target a number of .NET-aware programming languages. Unlike the SSCLI, Portable .NET and Mono are intended to be a full-blown framework for 'real-world' .NET application development.

Wrap Up

So! Here you are at the end of this article and you have yet to compile any code and undoubtedly have a number of unresolved questions regarding the .NET universe. Fear not, this was by design. The point of this first article was to lay the conceptual groundwork for the articles to come. First you learned that the CLI defines a common file format, common execution engine and common type system that can be implemented on the Mac OS X, Unix, Linux and Windows operating systems. Next you checked out some (but not all) of the namespaces provided by .NET, followed by an investigation of the language- and platform-agnostic aspects of the framework.

So, until next month, when we install and explore the SSCLI, allow me to welcome you to the .NET platform!


Andrew Troelsen is a seasoned .NET developer who has authored numerous books on the topic, including the award winning C# and the .NET Platform. He is employed as a full-time .NET trainer and consultant for Intertech Learning (www.intertechlearning.com) and spends his idle moments at work showing off his fancy new Macintosh PowerBook G4 to his envious cohorts. You can contact Andrew at atroelsen@mac.com.

 
AAPL
$100.11
Apple Inc.
+0.00
MSFT
$46.44
Microsoft Corpora
+0.00
GOOG
$576.36
Google Inc.
+0.00

MacTech Search:
Community Search:

Software Updates via MacUpdate

QuickBooks 2015 16.0.0.1352 R1 - Financi...
QuickBooks 2015 helps you manage your business easily and efficiently. Organize your finances all in one place, track money going in and out of your business, and spot areas where you can save.... Read more
Mac DVDRipper Pro 5.0.1 - Copy, backup,...
Mac DVDRipper Pro is the DVD backup solution that lets you protect your DVDs from scratches, save your batteries by reading your movies from your hard disk, manage your collection with just a few... Read more
SyncTwoFolders 2.0.5 - Syncs two user-sp...
SyncTwoFolders simply synchronizes two folders. It supports synchronization across mounted network drives and it is a possibility to run a simulation showing in a log what will be done. Please visit... Read more
FinderPop 2.5.7 - Classic Mac utility, n...
FinderPop is a Universal preference pane that extends OS X's contextual menus using a FinderPop Items folder much as the Apple Menu Items folder used to do for the Apple menu. It has other features... Read more
VueScan 9.4.45 - Scanner software with a...
VueScan is a scanning program that works with most high-quality flatbed and film scanners to produce scans that have excellent color fidelity and color balance. VueScan is easy to use, and has... Read more
LibreOffice 4.3.2.2 - Free Open Source o...
LibreOffice is an office suite (word processor, spreadsheet, presentations, drawing tool) compatible with other major office suites. The Document Foundation is coordinating development and... Read more
calibre 2.4 - Complete e-library managem...
Calibre is a complete e-book library manager. Organize your collection, convert your books to multiple formats, and sync with all of your devices. Let Calibre be your multi-tasking digital... Read more
Default Folder X 4.6.9b1 - Enhances Open...
Default Folder X attaches a toolbar to the right side of the Open and Save dialogs in any OS X-native application. The toolbar gives you fast access to various folders and commands. You just click... Read more
Beamer 2.0.4 - Stream any movie file fro...
Beamer streams to your Apple TV.... Plays any movie file - Just like the popular desktop movie players, Beamer accepts all common formats, codecs and resolutions. AVI, MKV, MOV, MP4, WMV, FLV. To... Read more
Adobe Premiere Elements 13.0 - Consumer...
Adobe Premiere Elements just got better. Now you can create quick movies from favorite parts of your clips or tell big life stories in full-on productions. Add motion inside movie titles, punch up... Read more

Latest Forum Discussions

See All

iPollute Review
iPollute Review By Nadia Oxford on September 30th, 2014 Our Rating: :: iPOLLUTE, uPOLLUTEUniversal App - Designed for iPhone and iPad iPollute is a delightful-looking pollution simulator, though it’s a bit light on “game” content... | Read more »
This Week at 148Apps: September 22-26, 2...
Your Source For The Latest App Reviews   | Read more »
Kill Shot Review
Kill Shot Review By Jennifer Allen on September 29th, 2014 Our Rating: :: OCCASIONAL MISFIRESUniversal App - Designed for iPhone and iPad Kill Shot is often satisfying, but its more than pushy in-app purchases will leave you... | Read more »
It Came From Canada: Vainglory
I’m going to be straight you with folks. I don’t know much about MOBAs, and I’m certainly no professional. That means I don’t know how well Vainglory, the upcoming multiplayer online battle arena showcased in the most recent Apple keynote, compares... | Read more »
The Tunnel – An Endless Fall Review
The Tunnel – An Endless Fall Review By Nadia Oxford on September 29th, 2014 Our Rating: :: FREE FALLIN' Universal App - Designed for iPhone and iPad The Tunnel – An Endless Fall is a bit harder to get the hang of than most “endless... | Read more »
Ubisoft Launches Just Dance Now in the A...
Ubisoft Launches Just Dance Now in the App Store Worldwide Posted by Jessica Fisher on September 29th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
For Better, or for Worse? How the New Ap...
With the release of iOS 8 (finally), Apple has made some noticeable changes on the App Store – bundles, videos, and Testflight integration, to name a few. Many of these additions will make things friendlier for App Store shoppers, but how has it... | Read more »
Asphalt Overdrive Review
Asphalt Overdrive Review By Jennifer Allen on September 29th, 2014 Our Rating: :: SHORT LIVED ADRENALINEUniversal App - Designed for iPhone and iPad Asphalt Overdrive is a fairly simple auto-running racing game, but one that’s... | Read more »
Kritika: Wrath of the Pirate King Update...
Kritika: Wrath of the Pirate King Update Introduces New Class: Shadow Mage. Posted by Jessica Fisher on September 29th, 2014 [ permalink ] | Read more »
Vampire Tribunals Review
Vampire Tribunals Review By Campbell Bird on September 29th, 2014 Our Rating: iPhone App - Designed for the iPhone, compatible with the iPad Hunt other vampires in the “real world” in this location-based multiplayer game.   | Read more »

Price Scanner via MacPrices.net

MacBook Airs on sale for $100 off MSRP, start...
Best Buy has the new 2014 MacBook Airs on sale for $100 off MSRP on their online store. Choose free home shipping or free local store pickup (if available). Prices valid for online orders only, in-... Read more
Apple Releases OS X Mavericks bash Update 1.0...
Apple has released a patch update for OS X Mavericks users to address the recently-detected “Shellshock” security bug in BSD UNIX’s bash shell. Apple says only a few Mac users who had manually... Read more
Pivotal Payments Ready for Apple Pay – FlexPo...
Pivotal Payments, a provider of merchant services and global payment processing solutions, has announced its proprietary FlexPoint platform will support credit and debit transactions through Apple’s... Read more
iStabilizer Announces Tabarm — First Friction...
iStabilizer, a specialist in universal lightweight compact tripods, steady cams, dollies, mounts, and remotes for smartphones, tablets, and cameras, announced today the iStabilizer tabArm, the first... Read more
IStabilizer Flex Smartphone Tripod Wins Usa T...
iStabilizer, a specialist in universal lightweight compact tripods, steady cams, and other products for smartphones, tablets, and cameras, has announced today that its iStabilizer Flex smartphone... Read more
13-inch 2.8GHz Retina MacBook Pro on sale for...
B&H Photo has the new 2014 13″ 2.8GHz Retina MacBook Pro on sale for $1699.99 including free shipping plus NY sales tax only. They’ll also include free copies of Parallels Desktop and LoJack for... Read more
15-inch Retina MacBook Pros on sale for up to...
B&H Photo has the new 2014 15″ Retina MacBook Pros on sale for up to $150 off MSRP. Shipping is free, and B&H charges NY sales tax only. They’ll also include free copies of Parallels Desktop... Read more
Get Down to Business On Your iPad With Free N...
Utah based Poem LLC has introduced Nexticy 1.0, a full-featured, affordable (Free) forms application for iPad. Nexticy makes it ‘way easy’ to create, store, retrieve and analyze paper-like forms of... Read more
13-inch Retina MacBook Pros on sale for $100...
Best Buy has 13-inch 2.6GHz Retina MacBook Pros on sale for $100 off MSRP on their online store. Choose free shipping or free local store pickup (if available). Prices are for online orders only, in-... Read more
Reports Outline Claimed 12-Inch Macbook Air D...
Blogger Jack March says that according to information he’s received from an anonymous “source familiar with Apple’s plans,” the next-generation MacBook Air will launch in mid-2015 and be available... Read more

Jobs Board

*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
Senior Event Manager, *Apple* Retail Market...
…This senior level position is responsible for leading and imagining the Apple Retail Team's global event strategy. Delivering an overarching brand story; in-store, Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
Project Manager / Business Analyst, WW *Appl...
…a senior project manager / business analyst to work within our Worldwide Apple Fulfillment Operations and the Business Process Re-engineering team. This role will work Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.