Differences with the .NET Framework
The .NET Compact Framework is a subset of the full .NET Framework. It implements approximately 30 percent of the full .NET Framework class library and also contains features and classes specific to mobile and embedded development.
This topic is not comprehensive of all differences between the frameworks, but lists the important differences needed for developing applications. The following table lists the areas of differences described in this topic.
The .NET Compact Framework does not currently support loading assemblies into a domain-neutral code area for use by multiple.
Although some languages support lower bounds other than zero, the common language runtime does not and throws aif the first element is other than zero.
The .NET Compact Framework is primarily a rich client platform and does not provide ASP.NET support. To develop Web pages for mobile devices, you can use ASP.NET mobile Web controls. To develop Web pages for personal computers or Web service providers, see your ASP.NET documentation.
Assemblies and File Formats
Applications for both Frameworks use assemblies. Both Frameworks access portable executable (PE) files, which contain the Microsoft intermediate language (MSIL) and metadata that define a .NET Framework application. A PE file can refer to a programming namespace defined and shared by other assembly files.
Seefor more information.
Assemblies and Global Assembly Cache
The .NET Compact Framework does not currently support multi-module assemblies but does support satellite assemblies.
Classes and Types
The .NET Compact Framework supports a subset of the .NET Framework class library. This subset is appropriate for applications designed to run on resource-constrained devices and is semantically compatible with same-named classes in the .NET Framework.
For information about determining .NET Compact Framework support, see.
The .NET Compact Framework supports COM interop in version 2.0. There are also enhanced marshaling capabilities. For more information, see.
Common Language Runtime
The common language runtimes in both Frameworks benefit from managed code execution, just-in-time (JIT) code compilation, and garbage collection. They support the Common Language Specification (CLS).
Both Frameworks have built-in primitive types as well as other types that you can use and derive from when building your application.
The common language runtime for the .NET Compact Framework is approximately 12 percent the size of the full .NET Framework common language runtime.
The .NET Compact Framework supports most of the Windows Forms controls in the full .NET Framework and contains controls specific to .NET Compact Framework.
Windows Forms controls are specially built for the .NET Compact Framework. For more information see.
The functionality of a current directory is not present in the Windows CE operating system, so the .NET Compact Framework does not support theand methods.
The .NET Compact Framework supports theproperty for a . However, its context is not preserved by the running executable in subsequent launches and file loads.
The .NET Compact Framework provides a subset implementation of ADO.NET and includes the SQL Server Mobile data provider. Thenamespace is not supported.
For more information about data support, see
Data Types and Floating-Point Precision
The .NET Compact Framework does not support theenumeration.
In a division calculation, if the divisor is very large or at the maximum or very low or at the minimum floating point value, the calculation returns zero instead of the correct calculation.
The MIPS platform does not support the full precision specified by the Standard for Binary Floating Point Arithmetic specification, and can cause unpredictable results. Because of performance considerations, the .NET Compact Framework does not provide a floating-point emulation capability for this platform.
Debugging at the Command Prompt
The .NET Compact Framework does not support the newprovided by the .NET Framework version 2.0. The older CLR Debugger (DbgCLR.exe) is deprecated in version 2.0 of both Frameworks.
Deploying is as easy as copying the assembly to the target device by using a cable from the desktop computer or its infrared port or by a wireless Internet or intranet connection. In Microsoft Visual Studio 2005, you can deploy directly to the device while debugging.
The .NET Compact Framework does not support configuration files for tracing, but you can use performance counters. For more information see.
The full .NET Framework does not guarantee that accessing properties or methods on a disposed object always succeeds. However, accessing some properties such as Text often does succeed on the .NET Framework. Due to implementation differences between the .NET Framework and .NET Compact Framework, accessing methods or properties on a disposed object will almost always fail on the .NET Compact Framework.
Encoding and Localization
Localization, or globalization, support, such as date formatting and sort tables appropriate for the locale, defers to the underlying operating system whenever possible for compatibility and size efficiency.
The .NET Compact Framework depends on the operating system for sorting data, so the sort results may be unexpected for some cultures.
The .NET Compact Framework does not support per-threadsettings.
For more information about globalization support, see.
The .NET Compact Framework supports theand events, but does not support the and events.
Exception Description Strings
The .NET Compact Framework provides exception error message strings in a separate DLL, System.SR.DLL, to save memory.
You can also provide exception strings for other cultures to localize applications.
File Names and Paths
Windows CE resolves a file name specified without path information as being in the root directory of the device, not in the application directory.
To ensure successful operations, specify absolute path information.
The .NET Compact Framework processes URI strings prefixed by the file:// scheme differently from the full .NET Framework. A relative file://myfile specification resolves as \\myfile. Using file:///myfile (three slashes) resolves as \myfile in the root directory.
You can get the version of an assembly with, but its support is dependant on the manufacturer of the device is cannot be guaranteed.
To get the name of the directory containing an application, see.
In the .NET Compact Framework version 2.0, DPI resolution is automatically handled in Visual Studio 2005 projects. For more information high resolution, see.
Because of differences in device operating systems, there are constraints and restrictions on the I/O model. The .NET Compact Framework does not provide file change notifications.
Because device I/O occurs in RAM, file and directory attributes cannot be set or accessed.
Installation and CAB Files
You can use CAB files and create MSI applications to distribute your applications.
The .NET Compact Framework supports development using Visual Basic and Visual C#, but does not currently support C++.
Not all Math methods are supported on all device platforms; however, they are included in the API for compatibility.
The .NET Compact Framework is optimized for battery-powered systems and avoids heavy use of RAM and CPU cycles. For more information about saving memory, seeand .
The .NET Compact Framework provides Infrared Data Association (IrDA) classes for making infrared connections and Web listening classes for servicing HTTP requests to the device. These classes are available only in the .NET Compact Framework. For more information see.
The .NET Compact Framework does not support code profiling or the Perfmon.exe file in System Monitor. However, there are performance counters you can use. See
for more information.
The .NET Compact Framework does not support all the code generated by the. To determine what code is not supported, see .
The .NET Compact Framework does not support thenamespace.
The .NET Compact Framework does not currently support the equality operator (==) when comparing reflection objects such as, , , , , , , and . As an alternative, see .
The .NET Compact Framework does not support remoting. You can usefor alternative solutions.
The .NET Compact Framework does not support client-side certificates and authentication using HTTPS. Use Basic authentication.
There are several important security differences and considerations described in.
Because of size and performance considerations, the .NET Compact Framework does not support binary serialization usingor SOAP serialization using .
There is, however, serialization support for transmitting object data using SOAP in XML Web services and serializing datasets to XML.
The .NET Compact Framework is 8 percent the size of the full .NET Framework redistributable package. The size on disk is 50 percent smaller due to Windows CE file system compression.
Not all socket options are supported. For more information, see.
String Manipulations, Regular Expressions
Applications that use regular expressions in the .NET Compact Framework are not binary compatible with applications that use regular expressions in the full .NET Framework, but they are source-code compatible.
There are up to four threads created by a .NET Compact Framework application:
A main application thread.
A thread used to control various period timers and time-outs that can be scheduled by the system or applications.
A thread used to track changes to the active TCP/IP interfaces (simulating the media sense behavior that is present on Windows XP but not Windows CE).
A thread that is used to run object finalizers. It is created when the first finalizable object is garbage collected.
For more information about threading support, see.
The value returned fromis specific only to seconds, not milliseconds. You can get a finer measurement by using the property.
Theand methods for a are not supported, but you can start and stop timing by setting the property of a to true or false.
Visual Basic My
The .NET Compact Framework supports the Visual Basic My feature (see), except for the following My objects:
The Web services client runs wsdl.exe generated assembles directly.
Do not use localhost to create a Web service on the device, because localhost refers to the device running the application, as in the device itself. Instead, you should use either the machine's name or its IP address.
Because of size considerations, the .NET Compact Framework does not support XML schema validation. It does support the XML Document Object Model (DOM). For more information, see.