C# Examples

C# Example Code

C# Introduction

C# is a simple but very powerful object oriented language introduced by Microsoft specially to work with the .NET platform. C# is similar to C++ in some in many ways and evolution of the C and C++ languages. It is a programming language designed for building a wide range of enterprise applications that run on the .NET Framework.

C# is intended to build solutions for the broadest range of clients server application, including Web applications, Microsoft Windows Forms-based applications. You can use C# language to develop powerful object oriented application which includes oops features like encapsulation, inheritance, and polymorphism etc.

C# is just one of the language available for .NET development, but as experience it is certainly the best. CSharp is certainly a language you can use to develop different kind of applications.

Windows Application:

Using C# you can develop windows application like MS Office which is reach in look and feel by using .NET framework library that includes button, menu, form, Textbox, label etc.

Web Application:

Using .NET framework, which include powerful system called ASP.NET with the help of C# you can create more interacting, highly secure and user friendly ASP.NET web application.

Web Services:

Web Service is the most popular technique to create versatile distributed application. Web Service is used to exchange data over the internet regardless of the language to develop the Web Service or system that it resides on.

Presently below C# versions are available.

 C# 2.0C# 3.0C# 4.0C# 5.0C# 6.0
Features addedGenericsImplicitly typed local variablesDynamic bindingAsynchronous methodsCompiler-as-a-service (Roslyn)
Partial typesObject and collection initializersNamed and optional argumentsCaller info attributesImport of static type members into namespace
Anonymous methodsAuto-Implemented propertiesGeneric co- and contravarianceNew Exception filters
IteratorsAnonymous typesEmbedded interop types ("NoPIA")Await in catch/finally blocks
Nullable typesExtension methodsAuto property initializers
Getter/setter separate accessibilityQuery expressionsDefault values for getter-only properties
Method group conversions (delegates)Lambda expressionsExpression-bodied members
Co- and Contra-variance for delegatesExpression treesNull propagator
Static classesPartial methodsString Interpolation
nameof operator
Parameterless struct constructors
Dictionary initializer