Abhi's den...

The piece of code which nobody cracked...

Browse by Tags

All Tags » C# (RSS)
Extension Methods - add methods to class
Consider the following class public class Person { public string FirstName { get ; set ; } private string LastName { get ; set ; } protected string Email { get ; set ; } public int Age { get ; set ; } virtual public void showName() { Console .WriteLine...
Posted: Feb 13 2010, 11:13 PM by cabhilash | with no comments
Filed under: ,
DataTable to Dictionary using LINQ
Sometimes we have to create generic dictionary from the values in datatable. Usually we will loop through all the rows in the datatable and add the relevant keys to dictionary object for ( int _iExRowCnt = 0; _iExRowCnt < dsReturn.Tables[0].Rows.Count;...
Posted: Dec 28 2009, 02:35 PM by cabhilash | with 4 comment(s)
Filed under: , ,
Anonymous types for dummies
Anonymous types are used to define strong types without defining the type. Anonymous types are strongly typed and checked at compile time. It provides a convenient way to encapsulate a set of read-only properties into a single object without having to...
LINQ for dummies - an overview
Why do we need LINQ? Most of us would have wrote code to access data from different data sources a database, in memory objects , XML files or from other formats. We have different guidelines, architectures and methods to process and retrieve these data...
Posted: Dec 26 2009, 08:50 PM by cabhilash | with 1 comment(s)
Filed under: , ,
Difference between a constant and readonly variables/fields : (constant vs readonly)
Most of us would have encountered these questions What is the difference between constant and readonly fields? When to use constant and when to use readonly fields? What is the advantage/disadvantage of each? Constants In C# you can declare a constant...
Posted: Dec 26 2009, 08:32 PM by cabhilash | with no comments
Filed under: , ,
using LINQ retrieve top N rows
Normally to return top N rows we use an SQL statement similar to the one below Select top N * from table but How can we achieve the same thing in DataTable I have seen many examples, using different methods. Most of the methods centered around the idea...
More Posts