Skip to main content

Posts

Showing posts from 2013

New features in C# 4.0

Introduction The major theme for C# 4.0 is dynamic programming. Increasingly, objects are “dynamic” in the sense that their structure and behavior is not captured by a static type, or at least not one that the compiler knows about when compiling your program. Some examples include • Objects from dynamic programming languages, such as Python or Ruby • COM objects accessed through IDispatch • Ordinary .NET types accessed through reflection • Objects with changing structure, such as HTML DOM script objects • Data readers and other user defined dynamic objects While C# remains a statically typed language, we aim to vastly improve the interaction with such objects. A secondary theme is co-evolution with Visual Basic. Going forward we will aim to maintain the individual character of each language, but at the same time important new features should be introduced in both languages at the same time. They should be differentiated more by style and feel than by feature s

Microsoft's .NET Framework

Microsoft's .NET Framework is comprised of two main components - the Common Language Runtime (CLR) and the .NET Framework class libraries . The CLR is the real foundation of the .NET Framework. It is the execution engine ( runtime environment) for all .NET applications. Every target computer requires the CLR to successfully run a .NET application that uses the .NET Framework. The main features of CLR include: 1.     Automatic Memory Management. 2.     Thread Management. 3.     Code Compilation & Execution. 4.     Code Verification. 5.     High level of security. 6.     Remoting. 7.     Structured Exception Handling. 8.     Interoperability between Managed and Unmanaged code. 9.     Integration with Microsoft Office System All .NET applications are compiled into Intermediate Language code (MSIL) . When executed on the CLR, MSIL is converted into native machine code specific to the operating platform. This process is done by a Just In Time (JIT) compiler

Code compilation stages under .Net Framework

There are four phases of code compilations under .Net framework as shown below:

C# & Encapsulation

Encapsulation means to create a boundary around an object to separate its external (public) behavior from its internal (private) implementation. Consumers of an object should only concern themselves with what an object does, not how it does it.  C# supports encapsulation via: – Unified Type System – Classes and Interfaces – Properties, Methods and Events

C# & Polymorphism

– A class can be used as its own type, cast to any base types or interface types it implements. – Objects may methods as virtual; virtual methods may be overridden in a derived type. These are executed instead of the base implementation                         

What is Object Oriented Programming?

To be object oriented, a language is designed around the concept of objects. that are something, have certain properties and exhibit certain behaviors. This means the language generally includes support for: – Encapsulation – Inheritance – Polymorphism                         

What is an Object?

An object typically models a concept: – An object usually “is” something –i.e. a customer – An object usually “has” data –i.e. the customer’s first name – An object usually “performs” actions –i.e. make a customer “preferred”