Share via


Framework Support and New Features 

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 increased .NET Framework feature support in the .NET Compact Framework version 2.0:

Expanded support Description

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 the 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 more classes in the System.Data namespace.

Events

Internal improvements have been made in raising events.

Exceptions

Improved exception handling by the following:

Generics

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

Globalization

Additional encodings are supported.

Assemblies

Friend Assemblies (C# Programming Guide) are supported.

Networking

Support for NTLM authentication and support for IPv6, the next generation of the Internet protocol.

CredentialCache is supported.

Performance for XML serialization is improved.

The .NET Compact Framework supports SOAP 1.2.

The .NET Compact Framework supports the following authentication protocols:

  • 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 and a How-to topic.

For an example, see MSMQ Book Order Application Sample.

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

See What's New in SQL Server Compact Edition

Strings

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

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

Threading

Support for the BeginInvoke, EndInvoke methods, and using parameters with the Invoke method.

Visual Basic My objects

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

XML support

XML support includes:

New Features

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

Feature Description

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. The .NET Compact Framework SDK is included in the .NET Framework SDK. For more information, see How to: Compile at the Command Prompt.

Force an earlier .NET Compact Framework version application to run 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 interoperabilty

    • 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 COM objects in your managed code

    • RCW (runtime callable wrapper) support enables calling from managed applications into COM objects. However, you cannot activate managed object 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 is 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 Type Library Importer (Tlbimp.exe) 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

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

See Also

Concepts

Windows Forms and Graphics

Other Resources

What's New in the .NET Compact Framework 2.0