Difference between Deferred and Immediate execution in Linq


Difference between Deferred and Immediate execution in Linq

What is Deferred Execution?
In the Deferred execution query will be executed and evaluated at the time of query variables usage. Let’s take an example to understand Deferred Execution better.

Example:
Following is a code for that.
 

using System;
using System.Collections.Generic;
using System.Linq;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var customers = new List<Customer>(
                new[]
                    {
                        new Customer{FirstName = "Jalpesh",LastName = "Vadgama"},
                        new Customer{FirstName = "Vishal",LastName = "Vadgama"},
                        new Customer{FirstName = "Tushar",LastName = "Maru"}
                    }
                );
 
            var newCustomers = customers.Where(c => c.LastName == "Vadgama");
 
            customers.Add(new Customer {FirstName = "Teerth", LastName = "Vadgama"});
 
            foreach (var c in newCustomers)
            {
                Console.WriteLine(c.FirstName);
            }
        }
 
        public class Customer
        {
            public string FirstName { get; set; }
            public string LastName { get; set; }
        }
 
    }
}



Here in the above code, I have created a customer class and then created a list of customers. After creating a list of customers I have written a query for selecting customers with last name “vadgama”. After writing that query I have added a new customer “Teerth” with “Vadgama” lastName, I have written a query before adding a new customer it should execute immediate but as where operator support deferred execution it will execute when newCustomer used in the code. So output will like following as expected with deferred execution.

 

 

So the flow of code will be like below.

 

 

 Linq operators that supports deferred execution
 

  •     OrderBy
  •     OrderByDecending
  •     Reverse
  •     Select
  •     SelectMany
  •     Skip
  •     SkipWhile
  •     Take
  •     TakeWhile
  •     Where
  •  

What is immediate execution?
In immediate execution query will be executed immediately. No matter whether collection is changed after it or not.
 

Example:
Let’s take example of immediate execution.
 

using System;
using System.Collections.Generic;
using System.Linq;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var customers = new List<Customer>(
                new[]
                    {
                        new Customer{FirstName = "Jalpesh",LastName = "Vadgama"},
                        new Customer{FirstName = "Vishal",LastName = "Vadgama"},
                        new Customer{FirstName = "Tushar",LastName = "Maru"}
                    }
                );
 
            var newCustomer= customers.LastOrDefault(c => c.LastName == "Vadgama");
 
            customers.Add(new Customer {FirstName = "Teerth", LastName = "Vadgama"});
 
            Console.WriteLine(newCustomer.FirstName);
        }
 
        public class Customer
        {
            public string FirstName { get; set; }
            public string LastName { get; set; }
        }
 
    }
}


Here in the above code I have written almost similar code to the deferred code execution just changed the operator LastOrDefault as it’s not supporting deferred execution and it will immediately execute query. Let’s run example to see how it works.
 

 

As expected the “Teerth” customer is the last one as we have added after query.But its displaying “Vishal” as it immediately execute query  So flow of the code will be like below.

 


 Linq operators that supports immediate execution:
 

  •     All
  •     Any
  •     Contains
  •     Count
  •     First
  •     FirstOrDefault
  •     Last
  •     LastOrDefault
  •     Max
  •     Min
  •     Single
  •     SingleOrDefault
  •     Sum
  •     ToArray
  •     ToDictionary
  •     ToList
  •  

That’s it. Hope you like it. Stay tuned for more..
 


Paging in Grid View using Slider Extender

This article demonstrates how to implement paging in GridView using Ajax Slider Extender.
Read More

Send email in asp.net with attachment

Send email in asp.net with attachment in asp.net
Read More

Caching in ASP.Net

Caching is a feature of ASP.NET that can dramatically improve the performance of your application by storing the page output or application data across HTTP requests.
Read More

Find Date Difference using Java Script

Enter two dates (including the time!) and this script will display the number of weeks, days, hours, minutes, and seconds between the two. The second’s field is optional, too. For an example, try entering your birthdates and compare it to today.
Read More

Various functions for validation in javascript

JavaScript can be used to validate data in HTML forms before sending off the content to a server.
Read More

Animation Using JavaScript

it is possible to use JavaScript to create animated images. The trick is to let a JavaScript change between different images on different events.
Read More

JavaScipt Timing Events

It is possible to execute some code after a specified time-interval. This is called timing events.
Read More

Insert Special Characters Using JavaScript

The backslash (\) is used to insert apostrophes, new lines, quotes, and other special characters into a text string.
Read More

Compare two dates in java script

The Date object is also used to compare two dates.
Read More

How to use cookie in java script

A cookie is a variable that is stored on the visitor's computer.
Read More

Update, Delete, Cancel in Gridview

In this Article you can learn how to edit, update, delete, and cancel in gridview.
Read More

Browser Detection

It can be very useful to detect the visitor's browser.
Read More

Error Handling by using JavaScript

Error is caught by the catch argument and the proper error message is displayed.
Read More

Mathematical Methods in JavaScript

The following example uses the round() method of the Math object to round a number to the nearest integer.
Read More

Defining RegExp in JavaScript

The RegExp object is used to store the search pattern.
Read More

How to crop images using JQuery in ASP.NET

By this article we came to know that how to put jQuery, JCrop and a FileUpload control together to allow users to upload images and crop them.
Read More

Transferring page values to another page

We always come into situations in which we need to transfer values from one page to another page. In this article, I will show you some ways of transferring values from page to page.
Read More

Dynamically Adding TextBox Control to asp.net Table

how to generate Table with TextBoxes dynamically based from the number of Columns and Rows entered from the TextBox control
Read More

How to use XSLT

what is XSLT and how to use it to transform a xml document using a simple example
Read More

Instant Messenger Status Indicator - AIM, Yahoo, ICQ, MSN, Skype

IM status indicator is as an easy and reliable way to check online status of certain instant messeng
Read More

Hashtable in CSharp

Hashtable is a collection that stores information using a mechanism called hashing. In hashing, we have key and value. Each value in the hashtable is determined by its key associated with it.
Read More

List in CSharp

List is a generic collection that implements a dynamic array. Its conceptually similar to the non-generic ArrayList. Sometimes we need an array to store large number of generic elements but at runtime we don’t know how large or how small it can be. To handle this situation C# has introduced List that expands and shrinks at runtime
Read More

Introduction to LINQ

LINQ is a new technology in .NET 3.5 that offers a unique way of querying data from diverse types of data sources.
Read More

Validation Controls in ASP.NET

ASP.NET has a series of validation controls that help you to validate the data entered by user before submitting to the web server.
Read More

How to pass the values from aspx page to asp page in a same project

In this article I will show you how asp.net and asp pages can exchange information from each other in the same project
Read More

How to use Pointer in CSharp

How to use Pointer in c#
Read More

Call CSharp Method by JavaScript in ASP.NET

This article will explain how to call c# method using a JavaScript method in asp.net.
Read More

GridView with SelectAll CheckBox using JavaScript and XML

In this article i am explaining how to bind GridView by a xml file and a common function that we need in gridview i.e. a check box that select all the check box of every row in grid without postback using JavaScript.
Read More

Looping Through Controls in ASP.NET

In my recent development I have badly needed to read all the controls from asp.net page. After searching I have found lots of solution. Now I want share with you one of these solution. In this solution we read all the control from asp.net page with out using master page.
Read More

Creating Object to a Class dynamically using Reflection

Reflection is the feature in .Net, which enables us to get some information about object in run time. That information contains data of the class. Also it can get the names of the methods that are inside the class and constructors of that object.
Read More

How to get the CheckBoxlist Value using Javascript

How to get the CheckBoxlist Value using Javascript in ASP.NET
Read More

How to get visitors Country, longitude, latitude from IP address is asp.net

Here I will show you to how to get visitor's Country,longitude,latitude from IP address is asp.net
Read More

.Net Coding Standards

It is very easy to understood your code to another programmer if you write it in a managed manner and follow some standards.
Read More

Custom Date Text Box in VB.NET

In this article you will learn how to use Custom Date Text Box in VB.NET.
Read More

DatagridView on which Enter key works as Tab

Custom DatagridView on which Enter key works as Tab
Read More

How can we write in App.config file at run time?

We can write in App.config file at run time.
Read More

An introduction to JSON

JSON is a very lightweight data format based on a subset of the JavaScript syntax, namely array and object literals. JSON allows communicating with server in a standard way. JSON is used as communication notation instead of XML.
Read More

How to get MAC address using CSharp

In this article I want to share with you some simple but important for our rapid development. Here I want to discuss how to get system MAC address using c# ,
Read More

How to show Page loading progress with modal background

How to show Page loading progress with modal background
Read More

Request format is unrecognized for URL unexpectedly ending in Web Method()

It was about web service related error.
Read More

XML Parsing Error-no element found

The common reason for XML Parsing Error: no element found is missing closing tag for one or two html element.
Read More

How to import data from an XML file to a table in SQL server 2005 or 2008

In this article I will show you how to import xml data into a table in SQL server 2005 or 2008. SQL server has strong querying capabilities to extract information from XML files.
Read More

How to remove html tag from string using Regex

This article shows how easily we can remove html tag from string using Regular Expression
Read More

Upload file using web service

This article is all about to uploading a file using web service.
Read More

List Control in Asp.Net

Sometimes we need a lookup (dropdown) from where we can select multiple items. For example, an emplo
Read More

How to get the online Users Count in ASP.NET

Today I wish to get the how many users in online codegain.com, base on that idea, I come cross to a
Read More

How To Play SWF File In Asp.Net

This article demostrates how to play an swf (flash) file in asp.net.
Read More

Http Handle

The HttpHandler are used by ASP.NET to handle requests.
Read More

Hosting WCF service in Windows Azure and consuming in Window 7 phone app

This article will give step by step walkthrough of hosting a WCF service in windows azure and then consuming that in windows7 phone application.
Read More

Disable Backspace key using java script

This code shows how to disable backspace key and enter key using java script
Read More

Converting a .doc file to .txt file using CSharp.NET

This article is all about converting a .doc file to .txt file or in other format.
Read More

How to dynamically add and change meta tags in MasterPage using ASP.NET and CSharp

This article demostrates how to dynamically add and change meta tags in masterpage.
Read More

How to show dropdown list items in multiple colors in asp.net

In this article I will explain how to show dropdown list items in multiple colors in asp.net
Read More

How to export listview in excel in asp.net

This article will show you how to export list view in excel sheet in asp.net.
Read More

How to create primary key on a table

In this codesnippet I will explain how you can create a primary key on a new as wel as on an existing table.
Read More

How to set default value in a column in Database table

Sometimes we need to set some default value in the table column when a row is created. Here I will show how to we can achieve it.
Read More

How to cleare login history of user from sql server

How to cleare login history of user from sql server
Read More

How to get IP address of a client machine in csharp

In my recent project I was told keep track of the IP address of all the visitors. Here I will show you how to get IP address of the client machine in csharp in asp.net.
Read More

how to generate random number in csharp

Here I will show how to generate random number in csharp.
Read More

How to create file in csharp

In this code snippet I will show you how to create file in csharp.
Read More

How to copy or move a file from one location to another location in csharp

In this code snippet I will show you How to copy or move a file from one location to another location in csharp.
Read More

Check whether an expression is numeric type in sql server

How to check whether an expression is numeric type in sql server.
Read More

Pass Viewstate across pages in ASP.NET

Yes, we can access the viewstate variables across pages. This is only possible if Cross Page Posting or Server.transfer is used to redirect the user to other page.
Read More

How to add remove and change css class using JQuery

Here in this code snippet I will show how you can add, remove and change css class in JQuery dynamically.
Read More

how to count number of elements in array using LINQ in CSharp

how to count number of elements in array using LINQ in CSharp.
Read More

How to find min max and avg in an integer array using LINQ in CSharp

How to find min max and avg in an integer array using LINQ in CSharp.
Read More

How to move the scroll bar by java script function

Move the scroll bar by java script function
Read More

LinqDatasource A Great Control for declarative programming

I have used data source control many times and its great it provides us great features for declarative binding. LinqDataSource Control is a great control and it allows us to bind linq queries without writing any code declaratively.
Read More

Difference between int.Parse and Convert.ToInt32

Difference between int.Parse and Convert.ToInt32
Read More

What is difference between HTTP Handler and HTTP Module

Difference between HTTP Handlers and HTTP Modules.
Read More

GUID Vs Int data type as primary key

Recently one of my friend ask me when I should go for GUID and When I should go for Int as primary key in table. So decided to write a blog post for it. Here are advantages and disadvantage of the GUID and INT.
Read More

Find lowest number in an array in LINQ

Find lowest number in an array in LINQ
Read More

Managing Session State in a SQL Server

In this article we will see how to configure Out-of-Process Session State through SQL-Server
Read More

How to make GridView Individual Cells Selectable

In some situations we need to make GridView each cell of the GridView selectable to fetch the cell i
Read More

Distinct operator in Linq

Distinct operator in Linq
Read More

Programmatically creating asp.net request and handling response

Programmatically creating asp.net request and handling response
Read More

Multi Monitor Support in Visual Studio 2010

Multi Monitor Support in Visual Studio 2010
Read More

HTML and Java Script code snippets in Visual Studio 2010

HTML and Java Script code snippets in Visual Studio 2010
Read More

Ctrl K D for source code formatting in Visual Studio

Ctrl+K+D for source code formatting in Visual Studio
Read More

Ajax ComboBox in ASP.NET

I have created a ComboBox control that mimics the functionality of Google suggest. As you type a search phrase, it automatically displays a list of matching entries in a dropdown.
Read More

Conveting Number to Word in C#

This is a c# function to convert numbers into words.
Read More

Removing outer table elements from Server Control's generated HTML in Asp.net 4.0

Removing outer table elements from Server Control's generated HTML in Asp.net 4.0
Read More

Refresh parent window after closing pop up window through Java Script

You can use this JS code to close the child window and then refresh the parent window.
Read More

How to check case sensitivity in sql-server

Here we describe the way to check case sensitivity in sql-server
Read More

File Downloading Code in C#

Generally we provide the facility to download certain file on some event like button click. So here I am providing simple c#.net code to do this.
Read More

How to call button click event from java script function

In many cases we need to call button click event from java script. So in this article I am going to describe how can we achieve this..
Read More

Reading PDF file to text in c#

This article shows how you can read a pdf file and put their content in a string variable very simpl
Read More

Filtered index in SQL Server 2008

A filtered index in an optimised nonclustered index, specially designed to index a sub set of data i.e, a portion of rows in as table.
Read More

Playing with dapper Micro ORM and ASP.NET MVC 3.0

Playing with dapper Micro ORM and ASP.NET MVC 3.0
Read More

Insert with Dapper Micro ORM and ASP.NET MVC 3

Insert with Dapper Micro ORM and ASP.NET MVC 3
Read More

Edit/Update with dapper ORM and ASP.NET MVC 3

Edit/Update with dapper ORM and ASP.NET MVC 3
Read More

Delete with Dapper ORM and ASP.NET MVC 3

Delete with Dapper ORM and ASP.NET MVC 3
Read More

Masked TextBox In WPF

In this article I am going to show how we can create a masked textbox in wpf.
Read More

MyCollegeMyFriend - An Open Source Project developed using ASP.NET 2.0

MyCollegeMyFriend is a small but open source project developed using ASP.NET 2.0 and C#.
Read More

Finding Saturday,Sunday between date range in C#/ASP.NET

Finding Saturday,Sunday between date range in C#/ASP.NET
Read More

Merge statement in SQL SERVER 2008

Merge is a great feature introduced in SQL server 2008 to perform multiple DML operations like INSERT, UPDATE and DELETE in a single statement very efficiently.
Read More

Maintaining Browser History for Ajax events through script manager in asp.net

Maintaining Browser History for Ajax events through script manager in asp.net
Read More

Introduction to viewbox in WPF

If we want to select a specific area from an image then how we will do it. The solution for this is ViewBox.
Read More

Inner join in LINQ

Inner Join returns a set of rows from two or multiple tables where there is match in join condition. Join in LINQ is a great feature introduced in .NET 3.0.
Read More

Get started with ASP.NET MVC and PetaPoco

Get started with ASP.NET MVC and PetaPoco.
Read More

Social Networking Website in ASP.NET - Open Source Project

The attached project is an open source social networking Web application project written in ASP.NET 3.5 and C#. Some of the features are for creating profiles, searching users, making friends, chatting and communication.
Read More

PetaPoco with stored procedures

PetaPoco with stored procedures in MVC.
Read More

Group join in LINQ

A join clause with an into expression is called a group join. A group join breaks up the joined table into sequences of objects each matching/corresponding to an object from the other table.
Read More

A look on Layout in XAML

In designing UI, layout is very important. In XAML in designing UI we have differenet type of layout such as Grid, StackPannel, Canvas, DockPannel etc.
Read More

A Project Report In WPF (R-Office Management System)

This is a small office management system. With the help of this project all office employee can connect with each other, request online leave, get birthday reminders, get status of present/absent employees and use an automatic attendence system when logged in and logged out. Just need to install and setup of this project to every machine.
Read More

Code refactoring with Visual Studio 2010 Part-1

Visual studio 2010 is a Great IDE(Integrated Development Environment) and we all are using it in day by day for our coding purpose. There are many great features provided by Visual Studio 2010 and Today I am going to show one of great feature called for code refactoring.
Read More

Printing the content of div or panel

In general, we required to print the content of a portion of page. We don't need that whole page will get printed. So here I am going to provide a small java script function that can solve this problem.
Read More

Creating Countdown function in C sharp

Here I am going to give a function in c# that display the countdown in a label control.
Read More

How to take backup and restore database in Microsoft SQL Server 2005 or 2008 using wizard.

Here in this article I am going to explain how to take backup and restore database in Microsoft SQL Server 2005 or 2008 pictorially using wizard.
Read More

An Open Source Project - R-Bank Management System

This is an open source project based on a Bank Management System. This project covers all functionality related to a bank. This project uses WPF.
Read More

Sql Server function to convert comma separated value into tabular format

Some times when writing sql query we have comma separated values and we want to convert it into tabular format so that we can apply in clause easily. So for that purpose I am giving a function that can perform this task very easily. You need to pass only the comma separated values as argument and it return the tabular format.
Read More

Making a button default clickable when enter key is pressed

Java-Script function to make a button default clickable on enter key press.
Read More

Composite key join in LINQ

In this article I will show how to use composite key join to perform join operation in which you want to use more than one key to define a match.
Read More

Introduction to Windows Azure

Well simplest answer in this simple language to above question is “ It’s a operating system which hosts number of services on cloud”.
Read More

Parallel for loop in C# 4.0

Parallel for loop in C# 4.0
Read More

Create setup of a window application in .Net step by step

How to make a executable file of a window application? How we can restrict other user to read our application source code?
Read More

Garbage Collector Algorithm

An algorithm on garbage collector in .NET
Read More

Code refactoring in C# with Visual Studio 2010 Part-2

Code refactoring in C# with Visual Studio 2010 Part-2
Read More

Code refactoring in C# with Visual Studio 2010-Part 3

Code refactoring in C# with Visual Studio 2010-Part 3
Read More

How to get current maximum value of an identity column in a table

There is a command DBCC CHECKIDENT, which can be used to get the current maximum value of an identity column in a table.
Read More

Function to Check illegal characters for preventing Sql Injection Attack

Here I have written a c# function to check illegal characters for preventing Sql Injection Attack.
Read More

Hello World application with ASP.NET pages and WebMatrix

Hello World application with ASP.NET pages and WebMatrix
Read More

Introduction to stuff in SQL Server

Stuff function in SQL server replaces a specified length of characters with a new set of characters from a string at a given starting location.
Read More

Gradient Effect in Silverlight

In this article I am going to show how we can show graident effect in silverlight. This is my XAML code in which I am going to show gradient effect.
Read More

Genarate an Excel Sheet from a XML file

In this article I am going to show that how we can show the data of a XML file in an Excel sheet. For doing this we have to use a XSLTFile.
Read More

Exception handling in WCF using SOAP Fault

This article is all about exception handling in WCF Service using Fault Exception. Here I am describing how to throw and handle Fault Exception.
Read More

C# function to remove illegal characters in a filename

This function remove all the illegal characters from a filename and return a valid filename so that you can perform file handling operation smoothly.
Read More

Convert Code from C# to VB.Net

Many time we need to convert certain c# code to vb.net or vice versa. So there is a tool available on net which can perform this task very easily.
Read More

AJAX Accordion Control in ASP.NET

The Accordion is a web control that allows us to provide multiple panes and display them one at a time. It is like having several CollapsiblePanels where only one can be expanded at a time.
Read More

Ajax DropShadowExtende

DropShadow is an extender which applies a "Drop Shadow" to a Panel.
Read More

Reading and Parsing a CSS file in ASP.Net

In this article I am going to show how we can read and parse a CSS file in asp.net.
Read More

Using some Mouse Property Of a Rectangle in XAML

This article is showing that how a rectangle control use in XAML.How we can perform mouse operation on rectangle?
Read More

Scroll Banner or Text in Silverlight

In this article I am going to show how we can scroll text or banner in silverlight.
Read More

AJAX Text Box Watermark Extender

This article shows how to use two new AJAX Controls, TextBoxWatermarkExtender and ValidatorCalloutExtender in ASP.NET 3.5.
Read More

WebBrowser Control in WPF

In this article, I am going to show how we can use WebBrowser control in WPF application.
Read More

On-line Address Book in ASP.NET 2.0

This is a small project on On Line Address Book. This small project will be very useful for those who are going to start or new in ASP.NET.
Read More

How to encrypt password or data in c#

This code snippet is useful for encrypting password or any other data.
Read More

COUNT VS EXISTS in SQL SERVER

If you want to check wether a rows or rows exists in a table for a given search criteria, which would be better choice between COUNT and EXISTS to check? And the answer is EXISTS.
Read More

Get query string value using JavaScript

This is simple codesnippet to get query string value in JS.
Read More

How to convert a class library project into web application

How to convert a class library project into web application? What is web application? Difference between website and web application?
Read More

Three common mistake while creating application with ajax

Three common mistake while creating application with ajax
Read More

How to get day name in Javascript

Here i will show you how to get day name in javascript.
Read More

Disconnect all other user from SQL Server DB

In this codesnippet I will show you how you can disconnect all other user from SQL Server DB except your own.
Read More

Disconnect all other user from DB

Many times we need all connections to be closed except our query and try the following methods.a) Search and kill all the connected users.b)Stop and restart the database server, then issue the command.d)Take the database offline etc. For example we want to restore datbase but system does not allow because some one is connected. This is really a pain though has to be done.
Read More

Top 20 Interview Questions of Asp.net and Sql-Server

In this article, I am giving 20 most commonly ask interview questions of asp.net and sql-server.
Read More

How to drop multiple tables in a single drop command in SQL SERVER

How to drop multiple tables in a single drop command.
Read More

Using IN clause to search in multiple columns of a table in SQL Server

Its possible to search a text in multiple columns of a table in SQL Server using a single IN instead of using multiple OR command.
Read More

Ordering data in LINQ queries by more than one column

In this post I am going to show how to do ordering when you require to order data by using multiple columns.
Read More

Jquery Ajax Calling functions

Jquery Ajax Calling functions
Read More

Validate integer value in java script

This is simple codesnippet to chech interger value is valid or not
Read More

how to get no of days in a month in javascript

tips to get no of days in a month in javascript
Read More

how to get if an year is a leap year.

codesnippet to get if an year is a leap year.
Read More

How to check if a string contains special charachter in javascript

How to check if a string contains special charachter in javascript
Read More

How to compare 2 dates in javascript

how to compare 2 dates in javascript
Read More

Call Virtual Functions From Constructors?

it is an important concept and not a just a puzzle or a brain teaser.
Read More

Printing Silverlight UI

In this article I am going to explain how to print a Silverlight UI
Read More

How to set default value to a column in a table in sql server

Here I will explain how you can set a default value to a column in an table in sql server.
Read More

LINQ TO SQL GridView (Enhanced Gridview)

LINQ TO SQL Enhanced Gridview
Read More

asdfasdfasdsdfasd

ffsdfsdfsdfsdfsdfasdfsadfsadf
Read More

Programming Practice for Server Side State Maintenance Variable

Programming Practice for Server Side State Maintenance Variable
Read More

Validate radio button list in javascript in asp.net

This code snippet will check if any of the radio button in the radio button list is selected or not in javascript in asp.net
Read More

Jquery and ASP.NET- Set and Get Value of Server control

Jquery and ASP.NET- Set and Get Value of Server control
Read More

Windows Azure Table Storage in detail

Windows Azure table storage provides two kind of storage 1) SQL Azure and other one is 2) Table,queue,blob and other storage like drives etc. In this blog post I am going to explain Table storage in details.
Read More

Understanding JSON

The JavaScript Object Notation, or JSON, is a lightweight format syntax for representing data used for exchanging data between client and server. JSON's elegance comes from the fact that it's a subset of the JavaScript language itself.
Read More

Ajax rounded corner control in ASP.NET

There is a very good control in AJAX to make rounded type shape. We can create rounded shape in many design by using Corners property of this control.
Read More

Uploading Multiple Files in ASP.NET 2.0

In ASP.NET 2.0, the FileUpload control enables the users to upload the files from your web pages. Here, I going to show, "how can you upload multiple files on a single click in ASP.NET 2.0
Read More

Transaction in .NET

This article shows how we can achieve successful transaction maintaining consistency of records in the database.
Read More

BigInteger in C# 4.0

In C# 4.0 Microsoft has added so many features and I love all most all the features. In today’s post we are going to discuss BigInteger Class.
Read More

Understanding JSON serialization and deserialization in ASP.NET

While working on an ajax application we need to transfer data from server to client anynchnously. This data transfer from server to client can be done in variety of formats. The common data formats are XML and JSON.
Read More

An introduction to Windows CardSpace

In this article I am going to show that, what is new Security mechanism in .NET 3.0, It named as Windows CardSpace.
Read More

Geographical Information by IP Address in ASP.NET and C#

This article and attached code demonstrates how to get a website visitor's geographical information such as country, region, city, latitude, longitude, zip code, time zone by using his or her IP address.
Read More

NuGet package with multiple projects

NuGet package with multiple projects
Read More

Replicate function in Sql Server

Replicate fucntion in Sql server repeats a string for a number of times specified by the user. For example if you want to repeat 'A' five times then just use replication function REPLICATE('A',5). It will produce 'AAAAA' as an output.
Read More

Simple function to check beginning or end of month

Simple function to check beginning or end of month
Read More

Take Backup of a DataBase By Coding

In this article I am going to show how we can show all Data Server in a network and on selecting a Data Server, how to show all DataBase of that selected Data Server and how to take backup of selected database on a particular location by code.
Read More

Creating a Breadcrumb like Menu using CSS and JQuery

Creating a Breadcrumb like Menu using CSS and JQuery
Read More

First Review of Visual Studio11 Developer Preview

Recently before some days at Build Conference on September 14,2011 Microsoft has announced release of “Visual Studio 2011 Developer Preview.
Read More

First Review of ASP. NET MVC 4.0 Developer Preview

After so much buzz Microsoft has launched some of the new tools at build conference and ASP.NET MVC 4.0 Developer preview is one of them
Read More

How we can consume/read RSS of a site in asp.net

In this article I am going to explain what is RSS and how we can consume/read RSS of a site in asp.net.
Read More

Introduction to Twitter Control in Ajax Control Toolkit

With twitter control you can display the recent tweets from a particular user by supplying the user's twitter screen name. Apart from this you can also display the result of the tweeter search.
Read More

Uploading file with Progress Bar in asp.net

In this article I am going to show how we can upload file with progress bar in asp.net
Read More

using treeview to show table data in hierarchical structure

In this article I am going to show how we can have table data in a tree view format.
Read More

Generic Code of Validating Fields with Jquery

Generic Code of Validating Fields with Jquery
Read More

New solution explorer feature in visual studio11 developer preview

New solution explorer feature in visual studio11 developer preview
Read More

Online shopping website in ASP.NET-open source

this project is online shopping cart made in .net 4.0 in which admin can update about the products and its description and the user can buy the products online
Read More

Save and retrieve image to and from database in asp.net

In this article I am going to demostrate how we can store and retrieve image to and database in asp.net.
Read More

Show money in international format in sql server

Codesnippet to show money in international format in sql server. For example converting 26583912.1254 number as 26,583,912.13 which is in international number format.
Read More

Increase Linq query performance by Compling it

In this article I will show how you can increase Linq query performance by Compling it
Read More

How to use DataLoadOptions in Compiled Linq query

In this article I am going to explain how to use DataLoadOptions in Compiled Linq query
Read More

Magnifying Glass Effect in Silverlight

Magnifying Glass Effect in Silverlight
Read More

ASP.NET MVC 4.0 Mobile Template

Microsoft has released the much awaited ASP.NET MVC 4.0 developer preview and there are lots of features bundle with it.
Read More

Default Extension methods

In this post I am going to discuss about Default extension method(s) which are use full when we query the data form the collection,array or performing operation while code using linq to sql.
Read More

Store Page ViewState in Session with asp.net

Store Page ViewState in Session with asp.net
Read More

Database operations in WPF application

In this article I demonstrated a small project report on School management System in WPF.
Read More

Month and Year Picker UserControl

Month and Year Picker UserControl
Read More

How to check table structure in SQL server 2008

How to check table structure in SQL server 2008
Read More

Get comma seperated values instead of resultset in sql server

Get comma seperated values instead of resultset in sql server
Read More

C# introduces a concept known as Indexers

Which are used for treating an object as an array
Read More

Extend your existing classes with extension method in asp.net 3.5

Extend your existing classes with extension method in asp.net 3.5
Read More

How to exposing custom event from custom control in asp.net

In this post I m going to discuss about registering custom event in custom control in asp.net
Read More

ASP.NET Error Handling: Creating an extension method to send error email

ASP.NET Error Handling: Creating an extension method to send error email
Read More

Cannot insert an explicit value into a timestamp column

Whenever we try to insert a value in a Timestamp column in a table using insert statement we get this error, "Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column.". Here I will explain why we get this error.
Read More

Cannot alter column 'CreatedOn' because it is 'timestamp'

Cannot alter column 'CreatedOn' because it is 'timestamp'
Read More

Get current zone time using GETUTCDATE() function in instance of SQL Server.

Sometime we need to get the current datetime of the system where the instance of SQL server(client) is running regadless of SQL server placed in other country or different time zone. Here I will explain how you can get local datetime where the client(instance of the SQL server) is running.
Read More

Number : A new Input type in HTML5

I have been writing few series of new HTML5 input types and this is another post on same series. In this post I am going to explain Number input types. The number type is for numeric values. When you use number input type it will have spinner with up and down arrow and with the help of this you can increase or decrease of value.
Read More

URL–New HTML5 input element

In earlier post we have seen how the email input tag work in the browser. HTML5 comes with lots of new goodies and today we are going to see one of another new html5 input types URL.
Read More

Easy URL routing in ASP.NET 4.0 web forms

In this post I am going to explain URL routing in greater details. This post will contain basic of URL routing and will explain how we can do URL routing in fewer lines of code.
Read More

Redirection in URL Routing

In one of the my earlier post I have written How easily we do URL rewriting in ASP.NET Web forms. In this post I am going to explain redirection in URL Routing.
Read More

Using TryParse Methods in C#

TryParse methods which is provided by the .net framewok is one of the important method when you are converting string data into perticular primary datatype and wants to verify that it is convertable in given type or not.
Read More

C# generics with primary datatype

Generic is feature which is useful when you have set of types which is going to perform some set of the functions which are same but the output differ from one type to another type.
Read More

How to upload file in ASP.NET MVC3

If you are a web developer you often need to upload file on the web server or database. In this post I am going explain how we can upload file in ASP.NET MVC 3 with razor syntax.
Read More

Get the Way of Reflection

What is Reflection? How we use Reflection? What are the advantages of using Reflection? Get the way of saving memory by using Reflection.
Read More

Extension Methods in C#

Method allow programmer to "add" methods to existing types without creating a new derived type, recompiling, or by modifying the original type. Methods are static methods they are called as if they were instance methods on the extended type.
Read More

Difference between SkipWhile and Where in linq

Before some time I have written a blog post about the SkipWhile operator and a reader of my blog asked me that we can do the same thing with Where also but there is a difference between this two. So In this post I am going to explain you difference between those two.
Read More

Tuple in C# 4.0

C# 4.0 language includes a new feature called Tuple. Tuple provides us a way of grouping elements of different data type. That enables us to use it a lots places at practical world like we can store a coordinates of graphs etc.
Read More

Namespace In C#

This article explain you about the Namespace in C#
Read More

ASP.NET Web API Basics

ASP.NET Web API is a framework for building web API on the top of .NET framework. It’s a framework for building and consuming web services that can be use at broad range of clients like browsers,tablets phones etc. You can expose JSON or XML whatever you want to use.
Read More

C# State machine - Yield

Yield keyword introduced in C#2.0. Yield keyword allow to create state machine and allow to iterate through the collection of objects one by one
Read More

Format Number To Display

Number of time the end user / client require to display numeric data in different format. In this post I am going to discuss about the various type of the custom format that provided by C#.net to achieve requirement. Here I am going to discuss each format one by one
Read More

Dividing web.config into multiple files in asp.net

When you are having different people working on one project remotely you will get some problem with web.config, as everybody was having different version of web.config. So at that time once you check in your web.config with your latest changes the other people have to get latest that web.config and made some specific changes as per their local environment. Most of people who have worked things from remotely has faced that problem. I think most common example would be connection string and app settings changes.
Read More

Multiple file upload with asp.net 4.5 and Visual Studio 2012

In earlier version of ASP.NET there is no way to upload multiple files at same time. We need to use third party control or we need to create custom control for that. But with asp.net 4.5 now its possible to upload multiple file with file upload control.
Read More

Calling Server Side function from Client Side Script

The post is about how you can call your code behind file function i.e server side written function from your client side code i.e using jQuery.
Read More

Model binding with ASP.NET 4.5 and Visual Studio 2012

In earlier version of the asp.net we have to bind controls with data source control like SQL Data source, Entity Data Source, Linq Data Source if we want to bind our server controls declaratively. Some developers prefer to write whole data access logic and then bind the data source with databind method. Model binding is something similar to asp.net mvc binding.
Read More

How to define Classes in JavaScript

In this article we will see different ways of defining and instantiating an object.
Read More

Extending Enum to return attached string

No of time there is requirement of getting string of Enum value to display purpose or to perform other task. So to deal with this requirement I wrote one extension function that get the string attached with the enum value.
Read More

Enhance String type to get Converted In Given Type

Converting string into a given type with C# Convert.ChangeType method.
Read More

Title

Description
Read More

Multiple file upload with asp.net mvc and HTML5

Multiple file upload with asp.net mvc and HTML5
Read More

Call Sql Server inbuilt functions using Linq

The post is about the the new class introduce in .net framwork for support of built in SQL-Server function. The SqlFunctions class allows to call SQL-Server function from linq queries while using EntityFramwork.
Read More

Delegate and Action and Func and lamda

This post is about the new delegate types included in .net framework which are Action and Function. How to use this type and what is difference between this two type. Also to resolve confusion between Action, Function, Delegate and Lamda.
Read More

Responsive WCF service With ICallbackEventHandler Interface

In this post I am going to discuss about the development of the WCF(duplex) callback service which replay back to consumer i.e client of service and about ICallbackEventHandler Interface implementation which provide response to the user on screen.
Read More

Fill Combo Box from the XML

Fill Combo Box by fetching the data from XML.
Read More

Assign ToolTip to dynamically created colum of silverlight Gridview

Assign ToolTip to dynamically created colum of silverlight Gridview and How to create style for element runtime
Read More

Return Anonymous type

In this post I am going to discuss about returning the anonymous type and how to handle in code. Following is list of fact about anonymous type.
Read More

title of the article of maximum 100 charachter length.

title of the article of maximum 100 charachter length. title of the article of maximum 100 charachter length.
Read More

Convert DateTime string to DateTime variable

In this post I am going to discuss about Conversion of String data in to DateTime.
Read More

Lazy in C# 4.0

Before C# 4.0 there was no on demand initialization by default. So at the time of declaration we need to create a value or object will be null or we have to create on demand initialization via coding.. But with C# 4.0 we now have lazy class. As per MSDN it support lazy initialization so it means if we use lazy class then it will initialize the object at the time of demand.
Read More

Parallel task in C# 4.0

In today’s computing world is all about Parallel processing. You have multicore CPU where you have different core doing different work parallel or its doing same task parallel. For example I am having 4-core CPU as follows. So the code that I write should take care of this.
Read More

How to sort a data table in C# with LINQ

One of friend today ask how we can sort data table based on particular column? So I thought it’s a good idea to write a blog post about it. In this blog post we learn how we can learn how we can sort database with LINQ queries without writing much more long code.
Read More

Replace line breaks in C#

In recent days I was working on a project want to replace \r\n to a new character but it was giving very strange behaviour. It was not replacing proper.
Read More

Visual Studio 2012 Tip- Closed All But Pinned feature

Visual studio 2012 is one of best IDE I have ever used. Everyday I am discovering something new with that IDE which is more productive. Today I have discovered “Closed All But Pinned” feature. I thought It’s a good idea to write a quick tip post.
Read More

Store data at browser using HTML5 Web Storage

Store data at browser using HTML5 Web Storage
Read More

DistinctBy in Linq

In this post I am going to discuss about how to get distinct object using property of it from collection. Here I am going to show three different way to achieve it easily.
Read More

Creating PDF file in ASP.Net MVC using RazorPDF

In this post we are going to learn how we can easily create PDF from ASP.Net application with the help of Razor PDF NuGet package.
Read More

Difference between Deferred and Immediate execution in Linq

In this post, We are going to learn about Deferred vs Immediate execution in Linq. There an interesting variations how Linq operators executes and in this post we are going to learn both Deferred execution and immediate execution.
Read More

Generate Sequcen Diagram (Visual Studio)

Following post is about feature provided by MS Visual Studio to generate sequence diagram from already written code.
Read More

Enhanced Scroll bar in Visual Studio 2013

In this post we are going to learn about Enhanced scroll bar in visual studio 2013. This part will also be part of Visual Studio 2013 feature series.
Read More

Knockout.js Introduction

We all know about jQuery It makes Java Script developers life very easy. But in Some scenarios jQuery does not help. For example there is no way where UI and data communicates with each other without writing complex code. Here JavaScript library knockout comes very handy. Knockout.js implement Model-View-View-Model pattern to JavaScript.
Read More

SelectMethod in ASP.NET 4.5 Model binding

In asp.net 4.5, It is also possible to bind controls with SelectMethod attribute. This method specify the data that you want to bind with data controls like grid view and repeater controls.
Read More

Code Lens in Visual Studio 2013

Microsoft has recently launched a Preview version of Visual Studio 2013 and I am using that more then a month now and discovering new features every day. In this blog post we will learn about code lens in Visual Studio 2013.
Read More

WCF Application Security in ASP.NET

WCF Application Security
Read More

throw vs. throw(ex) best practice and difference - c#

This article is all about showing the differences between throw and throw(ex) and what are the best practices when using it.
Read More

WaterMark or hint text in WPF by using DependencyProperty

WaterMark or hint text in WPF by using DependencyProperty
Read More

Export two list to CSV file

In this article we will convert two list to csv file.
Read More

How to pass parameters to a method executing by a thread in c-sharp

How to pass parameters to a method executing by a thread in c#.
Read More

Dynamic Keyword in Csharp

Dynamic Keyword in Csharp
Read More

int.Parse and Convert.ToInt32 and int.TryParse in cSharp

int.Parse and Convert.ToInt32 and int.TryParse
Read More

How to check and uncheck a checkbox in jquery.

Here is code to check and uncheck a checkbox in JQuery. To check a checkbox $('.#Checkbox1').prop('checked', true); To Uncheck a checkbox $('#Checkbox1').prop('checked', false);
Read More

How to check if a checkbox is checked or not using JQuery

How to check if a checkbox is checked or not using JQuery
Read More

Unable to update the EntitySet-because it has a DefiningQuery and no element exists to support the current operation

Today I was struggling to solve this strange error in entity framework while saving a new record in a table. "Unable to update the EntitySet - because it has a DefiningQuery and no UpdateFunction element exist to support the current operation."
Read More

How to convert bitmap to image in csharp

How to convert bitmap to image in csharp.
Read More

Use XSL in csharp

Use XSL in csharp
Read More

Create hidden field at run time using Jquery

Here is the code to create hidden field at run time using Jquery.
Read More

Search files based on created date in c-sharp

Search files based on created date in c-sharp
Read More

Creating PDF with ASP.Net MVC and RazorPDF

In this post we are going to learn how we can easily create PDF from ASP.Net application with the help of Razor PDF NuGet package.
Read More

HashSet in C#

In this blog post we are going to learn about HashSet collection in C#.
Read More

ASP.NET WEB API BEST PRACTICES

In this blog we will see that what all things we should keep in our mind while creating Web API project and what are the best practices of using ASP.NET Web API.
Read More

Why coding standards are important?

Why coding standards are important?
Read More

Shared project in Visual Studio 2015

Shared project is new feature that was added in Visual Studio 2013 update 2 but in visual studio 2015 it is coming by default. In this post we are going to learn about Shared Project and how it is different from class library.
Read More

NSubstitute Introduction and Why I like it

NSubstitute Introduction and Why I like it
Read More

How to use NuGet Packages

This is the fundamental article about what is NuGet packages, the benefit of NuGet, how to install, update and remove NuGet packages using GUI and Command line.
Read More

Fluent Migrator for Database Migration

Fluent Migrator makes the database migration very easy. It is a database migration framework for .NET and uses fluent interface to manipulate database.
Read More

Visual Studio 2015 Github tools

This article is about new Visual Studio 2015 Github tools and how to use it.
Read More

Inversion of Control and Dependency Injection using Unity

Inversion of Control (IOC) and Dependency Injection by using Unity
Read More

Deference between Debug and Release mode

Deference between Debug and Release mode
Read More

Why it's the right time to learn TypeScript

Why it's the right time to learn TypeScript.
Read More

Best way to do code review with GIT

Best way to do code review with GIT
Read More

How to create shapes in css

Lets create different types of shapes with powerful and amazing css
Read More

A Better Solution to create PDF with Rotativa and ASP.NET MVC

In this blog post we are going to learn about creating PDF with ASP.NET MVC with the use of Rotativa as open source framework for creating PDF with ASP.NET MVC.
Read More

How to check opened connection in sql server

Here is the code snippet to check how many database connections are opened in sql server.
Read More

Asp.net: Get the current Date Time of system

In this article I am going to explain how to get the current date time of system in asp.net. C# code: lbldatetime.Text = DateTime.Now.ToString(); VB.net code: lbldatetime.Text = DateTime.Now.ToString()
Read More

How is a .NET Distributed Cache Superior to Key Value Store?

ASP.NET web applications, .NET web services applications, and other .NET server applications need to handle extreme transaction loads without slowing down. And, although their application tier scales linearly, the data storage and database tier does not scale and therefore becomes a bottleneck. As a result, the entire application cannot scale.
Read More