.NET Framework Support and New Features

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

The .NET Compact Framework version 2.0 introduces new features and provides more support for .NET Framework classes. It also provides better performance in several feature areas, including just-in-time (JIT) compilation, garbage collection, XML Web services, and data access.

Support for Full .NET Framework Features

The following table summarizes the improved .NET Framework feature support in the .NET Compact Framework version 2.0.

Expanded support


Application domains

Support is provided for unloading an application domain.

Anonymous methods

The .NET Compact Framework supports the new C# feature that lets you include event-handling code in the delegate, as shown in the following example:

// In constructor.

button.Click += new EventHandler(sender,args)


// Increment a counter or other action.


Cryptographic support

The following features are supported:

  • X.509 certificates

  • Hashing:

    MD5 and SHA1

  • Symmetric key encryption:

    RC2, RC4, 3DES, DES

  • Asymmetric key encryption:

    RSA, DSA

DataSet improvements

The GetChanges method is supported, along with additional classes in the System.Data namespace.


Internal improvements have been made in raising events.


Improved exception handling by the following events is supported:


For information about generics support, see Generics in the .NET Compact Framework.


Additional encodings are supported.


Friend Assemblies (C# Programming Guide) are supported.


NTLM authentication and IPv6, which is the next generation of the Internet protocol, are supported.

CredentialCache is supported.

Performance for XML serialization has been improved.

SOAP 1.2 is supported.

The following authentication protocols are supported:

  • Negotiate

  • NTLM

  • Kerberos

Message Queuing (MSMQ)

Core functionality of using the MSMQ component and the System.Messaging classes is available. See Message Queuing in the .NET Compact Framework for more information.

Partial classes

The .NET Compact Framework supports partial classes, as used in Microsoft Visual Studio 2005 when you create a new project.

Registry keys

You can set registry keys by using the RegistryKey class.

An open RegistryKey and its open child RegistryKey objects must be explicitly closed before deletion of the key.

The maximum depth of registry keys is 15. This is a Windows CE limitation.

Serial ports

You can access serial ports as you can in the full .NET Framework. For an example, see Serial Communication Application Sample. Support for serial ports is also available with the Visual Studio 2005 emulators.

SQL Server

To download SQL Server Compact 3.5 Books Online, visit the Microsoft Download Center Web site.


The Substring method throws an exception if the startIndex parameter is greater than the length parameter.

String.Empty.Substring(0, 1) throws an ArgumentException.


The BeginInvoke and EndInvoke methods, and using parameters with the Invoke method are supported.

BeginInvoke and EndInvoke are not supported for asynchronous delegates.

Visual Basic My objects

The .NET Compact Framework 2.0 supports the following My objects:

XML support

XML support includes the following:

New Features

The following table summarizes new device-specific features in the .NET Compact Framework 2.0.



Stand-alone development

Although command-line compilation is supported in the .NET Compact Framework version 1.0, the .NET Compact Framework 2.0 provides greater stand-alone compiling and debugging support. For more information, see How to: Compile at the Command Prompt.

Ability to run an earlier .NET Compact Framework version application on version 2.0

See How to: Configure Runtime Version.

New controls in Microsoft.WindowsCE.Forms

See Windows Forms and Graphics.

Interoperability Enhancements

The .NET Compact Framework version 2.0 provides the following interoperability enhancements:

  • Native code interoperability:

    • Enhanced platform invoke type marshaling.

    • Marshal delegates as function pointers.

    • Additional types – arrays, strings, structures.

    • Embedded arrays – structs with char[], array[].

    • MarshalAs – type hinting.

  • Use of COM objects in your managed code:

    • RCW (runtime callable wrapper) support enables calling from managed applications into COM objects. However, you cannot activate managed objects through COM.

    • CCW (COM callable wrapper) support enables callbacks from native to managed code.

    • Support for late-bound and early-bound calls (IDispatch and vtable).

    • Integrated into Visual Studio 2005.

Although the .NET Compact Framework supports only a subset of the System.Runtime.InteropServices namespace, advanced marshaling capabilities are available with the support of the MarshalAsAttribute attribute. In addition, the .NET Compact Framework 2.0 supports several new members in the Marshal class. You can marshal a wide range of types through COM into the .NET Compact Framework, including all OLE Automation types. Custom marshaling, the COM single-threaded apartment (STA) threading model, and auto-generating class interfaces are not supported.

You can set a registry key to record marshaling of function calls in a log file. For more information, see How to: Create Log Files.

You can also use the Tlbimp.exe (Type Library Importer) with the .NET Compact Framework. In Visual Studio, you can add a reference to a COM type library in a device project.

Regarding packed structures, the .NET Compact Framework version 2.0 does not support Pack, but it does support the Explicit field and the FieldOffsetAttribute attribute. Note that current restrictions prevent marshaling a structure that violates the native structure layout. In other words, Int32 values must be 4-byte aligned, Int64 and Double values must be 8-byte aligned, and so on. If you need a packed structure where the elements are not naturally aligned, you must do the marshaling yourself.

For more information about interoperability and related how-to topics, see Interoperability in the .NET Compact Framework.

Resource File Change

The .resx file format in the .NET Compact Framework version 2.0 is the same as the format in the full .NET Framework. The same Resgen.exe (Resource File Generator) can be used for both Frameworks. The CFResgen.exe utility is no longer needed.

See Also


Windows Forms and Graphics

Other Resources

What's New in the .NET Compact Framework Version 2.0