Visual Studio 2010 CTP

Greetings! In order to try out fantastic features in the upcoming C# 4.0, today I downloaded Microsoft Visual Studio 2010 and .NET Framework 4.0 Community Technology Preview (CTP). Microsoft is currently providing Virtual Machine(VM) hard disk to be run on Microsoft Virtual PC SP1. The first look of VS 2010 shows you a new good looking start page built on WPF, which can be customized as well 🙂 There are plenty of features coming in C# 4.0 which we will discuss in the coming posts. For now, If you are interested in getting first look of the upcoming technology you Read more…

Using LINQ with Relational Data

Greetings, Till this point we have seen LINQ To Objects and LINQ To XML. I found a great webcast on using LINQ with Relational Data by Rob Bagby, So I thought instead of explaining my way, I would recommend you to go through the webcast 🙂 MSDN Webcast: Using LINQ with Relational Data (Level 100)

LINQ To XML

In my earlier post on LINQ, we saw an example of LINQ to Objects. In this post we will see LINQ to XML example. LINQ to XML was the real reason why i attracted towards LINQ. I’m pretty excited to see what LINQ provides as compare to the old techniques. So let’s start coding 🙂 Let’s say we have an XML as below: Now suppose that I want to get list of all employees in Microsoft. Without LINQ, I would probably load the xml in XmlDocument object and then apply XPATH with respect to the company name attribute. With LINQ, Read more…

Beginning WCF

Windows Communication Foundation (WCF) is an integral part of .NET Framework 3.*. “It provides a unified framework for rapidly building service-oriented applications that makes it easy to build and consume secure, reliable, and transacted Web services. It unifies the capabilities in ASMX, WSE, Remoting, COM+, and MSMQ; therefore developers need to learn only one programming model.” -MSDN And Today we are going to see a very very basic example of using Windows Communication Foundation(WCF). So let’s begin. Pre-Requisites: The first thing you need is .NET framework 3.*, 3.5 SP1 in particular 🙂 which you can download from Microsoft Download Center. Read more…

Hello LINQ

In Microsoft Pakistan Developers Conference (PDC) 2007, I attended a sessions on Language Integrated Query (LINQ) but until recent I didn’t utilize it seriously. But recently I go through some videos on LINQ at MSDN. I was impressed at all 🙂 LINQ is used to query data from objects. There are three basic categories of LINQ: LINQ to Objects LINQ to XML LINQ to SQL If you are new to LINQ, I would recommend to skim through article on LINQ on MSDN. Let’s see a simple example of LINQ to Objects. LINQ to Objects is used to query in-memory data Read more…

N-Tier Vs. Multi-Layered Architecture

Last week I was invited to assist Final Year Project Coordinator at University of Karachi to take viva for final year projects. So I observed one thing that students do not have clear picture between N-tier architecture and multi-layered architecture. So here I write few lines for them, hope that this will improve their understanding. Layered architecture refers to logical distribution/separation of components like, a rough example will be, separate DLLs for Business Logic Layer(BLL) or Data Access Layer(DAL). N-Tier refers to physical separation of components either on same machine or across different machines. For example, We have 3-tier architecture Read more…

Object Initializers in C# 3.0

C# 3.0 facilitates programmer by providing the feature of Object Initializers for both Named and Anonymous types. Object Initializer let you assign values to any accessible fields or properties without the need to create a explicit constructor. Consider the code below: private class Student {      public string Name { get; set; }     public int Age { get; set; } } static void SomeMethod() {     // Object initializer     Student stObj= new Student {Name = “Adil”,  Age = 24 }; } If we notice in the code above, the properties of student are assigned values directly with the Read more…

Implicitly Typed Local Variables

Earlier we saw a new feature “Automatic Properties” in C# 3.0. Today we are going to see the use of new ‘var’ keyword. C# 3.0 allows local variables in methods to have an implicit type by identifying it from the type of its initial value. For instance, var str = “Adil“; // str is compiled as a string var col = new[] { 0, 1, 2 }; // col is compiled as int[] var anoType= new { Name = “Terry“, Age = 34 }; //anonymous type When you call the GetType method on str, it will return System.String type. A point Read more…

Design Patterns

Design Patterns are reusable solutions to a commonly occurring problem in software. It’s not a ready to use code instead it is more like a general template or solution for a particular problem. When you get understanding of Design Patterns then at a time designing solutions you can come across a situation like “Oh Yes! I can apply here that particular design pattern” 🙂 Design Patterns provides you a proven and tested solution to a particular problem. They speed up design process and hence enhances productivity. I’m not going to give detail introduction to Design Patterns as purpose here is Read more…