An old presentation I gave to some professional C/C++ programmers to introduce the high-level concepts of .NET, including the definition of .NET from three different points of view.
interoperability •Code can but does not have to conform to CLS ◦uint is not a CLS compliant type, but exists in C# •Allows for a wide variety of languages to be built to run in the same environment
compiled into native code ◦This means that you do not have to have different builds to optimize for different types of hardware ◦Your code is more portable •Provides garbage collection services •Supports uniform exception handling
have been built to run on the CLR •Some examples: ◦C#, C++/CLI, VB.NET, F#, IronPython, IronRuby, Powershell •It is not uncommon to build different parts of a single application in different languages, based on requirements •You can even use multiple languages to build a single library (DLL)
new call in C# asks the CLR to find a location in memory large enough for your object ◦The CLR may or may not allocate new memory blocks for this purpose ◦The returned value is a reference that is tracked by the CLR ◦When all references to a single object fall out of scope, that object is a candidate for garbage collection
collection cleans up after your object, so you do not need to call delete ◦Garbage collection occurs outside your control, so you do not know when an object will be deallocated ◦If you do not control when garbage collection happens, how do you know when to release any unmanaged resources?
connection) is a common problem •To use the pattern, implement IDisposable •Call the IDisposable.Dispose() method as soon as possible •Can tell the garbage collector to ignore this class when it runs •C# provides some nice language constructs that make using the Dispose pattern even easier
compiled into a Common Intermediate Language (CIL) •Formerly known as Microsoft Intermediate Language (MSIL) •The runtime compiles the CIL into native code just-in-time (JIT) at runtime •Optimizes for the capabilities of the machine (e.g., SSE extensions, 3D Now!, etc.) •This means that the code you write today will run faster on tomorrow's hardware without a recompile or redistribution •This means that you do not have to have different optimized builds when you ship your application
and the application framework •.NET encourages the use of the right language for the job, even multiple languages for a single application •.NET enables developers to be incredibly productive by managing some of the more difficult aspects of programs, such as memory management •.NET provides a JIT compiler with the CLR that ensures that applications developed in .NET are optimized to the greatest extent possible