Click here to Skip to main content
Click here to Skip to main content

Overview of the .NET Framework

, 8 Nov 2013
Rate this:
Please Sign up or sign in to vote.
Components which .NET Framework provides

Introduction

The .NET is a very large framework and sometimes is hard to decide whether to code something or use an existing component of the framework. Sometimes is faster to code, but when production workload and reliability comes into play, the perspective is different. An overview of what .NET offers is a fundamental knowledge. It is hard to keep in track because .NET evolves very fast. This article discusses essentials which is the .NET Framework built from.

Contents

.NET 1.0

Common Language Runtime

The most significant characteristics of the .NET Framework is the ability to use classes and call methods across different languages. Almost everything is written in C# now, but when this language will be beaten by something revolutionary new, it will not be necessary to rewrite all C# code and libraries.

All languages are compiled into Common Intermediate Language and this language is compiled to the native code for the processor architecture where the code runs. That’s why the C# is called managed language. The .NET is the fastest runtime compare to others. It is slower just about 5% compare to the native code, but the benefits are huge.

Garbage Collector

The garbage collector make us free from the old C++ world where is necessary to manage the memory. The .NET takes care of it. Since .NET 4 the garbage collecting is processed in the separate thread, so the performance is more than sufficient.

ADO.NET

ADO (ActiveX Data Objects) was part of COM (Component Object Model) for accessing data sources. ADO.NET has nothing common with it but the name. It is a framework in System.Data namespace for accessing mainstream databases. Every serious database manufacturer delivers its provider for the ADO.NET, which means the .NET Framework support.

String

In whole .NET is the only one and single string type used to represent a string value. The string is internally represented in the UTF-8 format and in memory exist only one instance. It seems to be a sure thing, but the hard-to-survive C++ world is far away from it.

.NET 1.1

Regular Expressions

Regular expressions provide a powerful, flexible, and efficient technique for string processing. When you need to pick up something from the string, think seriously about regular expression use. There is quite a complex theory around it, but it is worth to learn it. The .NET implementation is compatible with Perl 5 and supports right-to-left matching and on-the-fly compilation.

1st XML processing

The XmlDocument class in the System.Xml namespace provides XML document parsing and browsing. It offers XPath language for data extraction.

HttpUtility

The HttpUtility is very important static class used for encoding and decoding URL arguments when processing web requests. Specially one method is extremely useful – the HtmlDecode method, which replaces HTML entities with equivalent Unicode characters.

String Builder

Don’t even thing about concatenating several strings in the loop other than via the StringBuilder class. It uses char arrays internally and is extremely optimized. Of course, writing strings directly to the stream when possible, avoids high memory consumption.

.NET 2.0

Generics

The C# is very type safe language. Generics algorithms are abstracted and require type features they need. Those features may be described by interface or abstract class. For example the most common is the IEnumerable<T> which is a collection of some object.

Event Log

EventLog is the unified logging system for Windows. Instead of managing creating and truncating logging files or filtering and categorizing data, the EventLog class takes care of it.

Configuration Manager

The ConfigurationManager class contains connection strings and other constants you want to change without need to recompile. The referenced DLL assembly can access main executable assembly’s configuration file too. In the ASP.NET the configuration file is the web.config file.

SQL Server

You can write SQL Server‘s stored procedures in the .NET language. It can be sometimes useful, but the .NET assembly must be stored into database via T-SQL command. Only the 2.0 version is supported.

Nullable Types

There are reference types and value types. Very important to know in C++ world, but rarely need to realize in C# world. Reference types are objects and value types are int, long, byte, bool, short, char and so on. Only value types need ref parameter keywords. Also only value types are not initialized with the null default value because they don’t point to anything. They are initialized with some default value instead. It is often awkward. That’s what nullable types are for.

.NET 3.0

XAML

XAML allows creating a user interface in HTML-like language. Declarative way has many advantages. One of them is binding – essential of the MVVM design pattern. XAML is accelerated by a graphics card which means it’s very fast.

Web services

Web services are good for invocation of remote methods on a server from a client. Web services are also standardized, therefore often used in interoperability scenarios. They are called WCF Services.

Workflow

The workflow is an activity model. It can be anything from a business process to a Team Foundation Server Build. The advantage is that activity is defined declaratively by XAML instead of code. It can be modified as easily as configuration file without the need to recompile.

1st feed processing

The SyndicationFeed class proves support for RSS 2.0 and Atom 1.0 syndication formats.

.NET 3.5

Language Integrated Query

The LINQ is a killer feature for other languages and must-have capability once used to work with. The LINQ is something like a SQL for object oriented programming. All the operations like sorting, taking top n items, looking for items which satisfy some condition; all this stuff can be made very easily and elegantly in a single line by LINQ.

Entity Framework

When you learn LINQ and realize it is much more comfortable than SQL, you want to use LINQ for database queries. That’s what the Entity Framework is made for. Since the version 4 you can write your classes which matching database tables and use them instead of database schema. You can also generate database schema from them. It is called Code-First approach. When you need later to update database schema, you can use Database Migrations. It is simple method which describes schema changes and manages migrations to the latest schema automatically by Entity Framework.

2nd XML processing

The XDocument class in the System.Xml.Linq namespace is designed to be used with LINQ. XDocument provides in-memory APIs rather than streaming ones.

Reactive Extensions

The Rx is a library to compose asynchronous and event-based programs using observable collections and LINQ-style query operators. It is not embedded into .NET Framework yet, but significant enough to be listed here. In comparison with TPL introduced later, Rx is designed to work with data streams while TPL is familiar with the producer-consumer pattern.

.NET 4.0

Managed Extensibility Framework

MEF was integrated into .NET Framework into the System.ComponentModel.Composition namespace. It allows using assemblies as modules. When you need to create a modular system, MEF takes care of getting together all modules.

Parallel Extensions

Parallel Extensions contains Parallel LINQ (PLINQ) and Task Parallel Library (TPL). When you have a lot of work to do, it is worth to use a task-based approach. Split the work into many small tasks and run them as you need. Run them sequentially or in parallel, but without managing threads. Parallel class takes care of processors count and the efficient number of concurrent threads. When you program on this level, you should use appropriate collection classes – concurrent collections in the System.Collections.Concurrent namespace.

Dynamic Language Runtime

You can use a dynamic type when you need to interact with type lacking environment, dynamic languages or whatever. It is very useful when interacting with COM environment because it does not provide the IntelliSence.

Lazy initialization

When the program contains something time consuming to initialize, which may not be used during the program lifetime, use a lazy initialization is a very good idea. Lazy<T> object initialization occurs when the object is accessed for the first time.

.NET 4.5

Asynchronous Pattern

Asynchronous programming was always possible in .NET, but it sucks, until the .NET 4.5. It introduces the await keyword, the imported F#’s pipe forward operator. When the threads just waits to the server respond, it actually does nothing but consuming machine’s resources. Separate thread is good for large computing tasks, but not for waiting thus blocking operations. The keyword await means: “Hey, this will take a while, do something useful in the meantime.”

Simple web programming interface

The HTTP protocol becomes a wide standard for data exchange for its useful features other protocols don’t have. Use methods that take single Uri argument in order to manipulate data. For example:

  • XmlDocument.LoadFromUriAsync downloads and parses the XML file.
  • WebClient.DownloadStringAsync serves downloaded content directly as a string.
  • WebClient.DownloadFileAsync saves downloaded content to the local storage.
  • WebClient.UploadFileAsync uploads a file to the server.
  • WebClient.PostAsync is the easiest way to send a POST request.

JavaScript Object Notation

JSON becomes lightweight universal object serialization format compared to XML. The JsonObject is a concurrent of very serious and solid Json.NET library used with older .NET versions.

AtomPub

The AtomPubClient class enables HTTP CRUD access to web resources using the AtomPub protocol.

2nd feed processing

Like its predecessor, the SyndicationClient class proves support for RSS 2.0 and Atom 1.0 syndication formats.

3rd XML processing

The XmlDocument class in the Windows.Data.Xml.Dom namespace provides easier that even before XML document manipulation. Inspired by JavaScript’s HTML document object model, it contains GetElementById and GetElementsByTagName methods. I suppose web developers will love approach this class provides.

TPL Dataflow

The TDF, living in the System.Threading.Tasks.Dataflow namespace, is the foundational layer for the asynchronous and concurrent programming using Task provided in Task Parallel Library. It provides a high-level approach necessary to manage large amount of data.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Václav Dajbych
Software Developer
Czech Republic Czech Republic
I am part of the IE userAgents community that recognizes, connects, and empowers passionate web developers to raise awareness about the importance of web standards and cross-browser coding best practices.
Follow on   Twitter   LinkedIn

Comments and Discussions

 
SuggestionMessage Automatically Removed PinmemberAyesha Sharma26-Mar-14 23:27 
GeneralMy vote of 5 PinmemberSilvabolt14-Nov-13 5:25 
QuestionNice generalization PinmemberYusubov E.11-Nov-13 10:02 
GeneralBrief and Comprehensive PinmemberBilal Haider11-Nov-13 6:22 
GeneralVery good and clear summary! PinmemberTeruteru31411-Nov-13 3:19 
Questionsource code samples ? Pinmemberkiquenet.com11-Nov-13 0:34 
AnswerRe: source code samples ? PinprofessionalVáclav Dajbych17-Jun-14 9:31 
GeneralRe: source code samples ? Pinmemberkiquenet.com17-Jun-14 10:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140718.1 | Last Updated 8 Nov 2013
Article Copyright 2013 by Václav Dajbych
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid