TechBubbles Microsoft Technology BLOG

CategoryC#

C# IDE Tips & Tricks Part 2

This post explains the some more tips on using Visual C# IDE to enhance developer productivity. Solution Configurater  Right click your solution in your IDE then select the ConfigurationManager  you see the following window   where you have the option to select the project for building. We can select the required project in the solution and can you can build the project. Solution...

Singleton Design Pattern in C#

Best known Creational Design Pattern is Singleton. We can implement this pattern in different ways. I am explaining some of the ways where we can implement in C#. We will have the following concepts in implementing the Singleton pattern We declare a private constructor which prevents other classes to create an instantiation of the singleton class. It also prevents the sub classing. We declare a...

C# IDE Tips & Tricks Part 1

C# Developers have been spending most their day activities with Visual studio IDE. They may have to understand the following activities to do their job. Understanding Code Developer must be able analyze the relationship between classes and what API it is using for implementing the logic. Navigating Code Developer may or may not know where he want to navigate to the code and keep track of visited...

C# ?? operator

The ?? operator in C# called null-coalescing operator is used to define a default value for a nullable value types and reference types. It returns the left-hand operand if it is not null and returns right-hand operand if it is null. example // ?? operator example . int? x = null; int y = x ?? –1; // Here the value of y will be –1. int i = GetValue() ?? default(int); Assigns the return value...

Using keyword in C#

Introduction Using keyword in C# can be used as directive and as well as statement. When you use using as Directive you will get the following advantages You can use the types in a namespace by declaring with using keyword.         example: using Systetm.Web;   You can define a alias for the nested namespaces        example:...

The Future of C#

Introduction
This post speaks about the future of C# which presented by Anders Hejlsberg chief architect of C# at PDC 2008. The coming version C#4.0 is much concerned on introducing Functional and Dynamic programming language concepts into the C#. It also speaks about C#4.0 features.

The factors that shape the C#4 are

Declarative programming
Dynamic programming
Concurrence programming

Lambda Expressions in C# 3.0

Lambda expressions is one of the features introduced in the C# 3.0. Lambda expressions help you to ease the burden of writing verbose Anonymous Methods. I will explain the where to use the Anonymous methods first then we see the example on lambda expressions Anonymous Methods Anonymous Methods is the feature in C# 2.0. The idea behind writing the anonymous methods is to write methods inline to...

Object and Collection Initializers Feature in C# 3.0

C# 3.0 introduced the another interesting feature Object and Collection initialization expressions. Object Intialization  Expressions allows you to initialize an object without invoking the constructor and setting its properties. If you take Employee Class as an Example: public class Employee { private int iEmpId; private string strFirstName; private string strLastName; public int ID{ get{...

Automatically Implemented Properties Feature in C# 3.0

Introduction of Automatic Properties in C# 3.0 make property declaration more concise. It saves some of your time in typing a lot of code. Example: class Employee { public string FirstName { get; set; } } Benefit of using Automatic Properties We have been creating properties in so many projects and notice that we are writing so many lines of code just for creating a simple property. Example:...

Test driven development using C#

This post explains how TDD can be implemented in C# using NUNIT. You can read the Introduction TDD to get an idea on TDD. Nunit is a open source framework to for .NET which helps you to automate the unit testing. Nunit can downloaded from the Nunit site. current version is 2.5. Nunit provides two utilities for running the automated tests nunit-gui.exe – GUI tool nunit-console.exe – Command...

TechBubbles Microsoft Technology BLOG

Follow me

Archives

Tag Cloud