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 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 { 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 = 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 Read more…

Binding Enum to ComboBox

Hi, Whether it’s Windows Forms or Windows Presentation Foundation While working with ComboBox, we usually want to bind any list as ComboBox Items. For example, //In windows forms string[] names = { “Microsoft”, “IBM”, “Apple” }; cmbNames.DataSource = names;Ā  //cmbNames is comboBox ID or //In windows presentation foundation string[] names Read more…

Generic Methods in C#

Hi, One of the great features of C# is Generic Method. Back in sometime I wrote a Generic Method which serializes or de-serializes an object. The Generic methods are declared with type parameters. So here is the code snippet I wrote some time earlier: public static void DoSerialization(Stream stream, SerializationType Read more…

C# ? According to Microsoft

“C# is a simple, type-safe, object oriented, general-purpose programming language. Visual C# provides code-focused developers with powerful tools and language support to build rich, connected web and client applications on the .NET Framework.” -MSDN

String vs. StringBuilder

Well some juniors told me that they have started C# so they want me to start some beginner level discussion on C# .NET The first thing that came in my mind for novice was comparison between string and string builder class. I don’t know whether you have noticed it or Read more…