Information Technology Reference
In-Depth Information
Interoperability
The .NET Framework was designed for interoperability between different .NET languages, the
operating system, and COM.
.NET language interoperability allows software modules written using different .NET
languages to interact.
-
A program written in one .NET language can use and even inherit from a class written
in another .NET language, as long as certain rules are followed.
-
Because of its ability to easily integrate modules produced in different programming
languages, the .NET Framework is sometimes described as
language agnostic
.
The
platform invoke (P/Invoke)
features allow code written for .NET—called managed
code—to call and use code not written for .NET, such as the Win32 system calls.
The .NET Framework allows interoperability with COM, in that .NET software compo-
nents can call COM components, and COM components can call .NET components.
No COM Required
The .NET Framework frees the programmer from the COM legacy. As a C# programmer, you do
not need to use COM, and therefore do not need any of the following:
The
IUnknown
interface
: In COM, all objects must implement interface
IUnknown
. In con-
trast, all .NET objects derive from a single class called
object
. Interface programming is
still an important part of .NET, but it is no longer the central theme.
Type libraries
: In .NET, information about a program's types is kept together with the
code in the program file, not in a separate type library the way it is in COM.
Reference counting
: The programmer no longer has to keep track of references to objects.
In .NET, the GC keeps track of references and deletes objects when appropriate.
HRESULT
: The
HRESULT
data type used in COM to return runtime error codes is not used in
.NET. Instead, all runtime errors produce
exceptions
.
The registry
: This system-wide database that holds information about the operating sys-
tem and application configurations is not used when deploying .NET applications. This
simplifies installation and removal of programs.