Wriju's BLOG

.NET, Cloud and everything

ADO.NET Entity Framework 4.0 : POCO – The Code Only Approach

POCO in ADO.NET Entity Framework 4.0 has been discussed in many places. Here I am not going to talk about it. However, I created a small sample to demonstrate the capability of POCO in much more cleaner “code-only” approach. <<Apology for this blog post issue>>. There were some images, due to which it was not… Read more

.NET Framework 4.0 Newbie : File.ReadLines

In .NET Framework 4.0 instead of you using File.ReadAllLines() use ReadLines() to get a better performance. Question is why? File.ReadLines() uses IEnumerable to get the lines. Unlike File.ReadAllLines() it does not first read full files and the starts reading if you have implemented the iteration. Also File.ReadAllLines() does not implement MoveNext().   But there is… Read more

.NET Framework 4.0 Newbie : String.IsNullOrWhiteSpace

In .NET Framework 4.0 we have String.IsNullOrWhiteSpace. String sData = ” “;   if (String.IsNullOrWhiteSpace(sData)) {     Console.WriteLine(“Nothing to do”); }   This would help us to determine whether to work with a string without calling additional Trim() method. Namoskar!!!… Read more

.NET Framework 4.0 Newbie : Addition to Environment.SpecialFolder enum

In .NET Framework 4.0 we have few new useful Environment variables, AdminTools CDBurning CommonAdminTools CommonDesktopDirectory CommonDocuments CommonMusic CommonOemLinks CommonPictures CommonProgramFilesX86 CommonPrograms CommonStartMenu CommonStartup CommonTemplates CommonVideos Fonts LocalizedResources MyVideos NetworkShortcuts PrinterShortcuts ProgramFilesX86 Resources SystemX86 UserProfile Windows In addition to that Environment.GetFolder path now has one additional overload which accepts Environment.SpecialFolder enum as parameter. These address a… Read more

.NET Framework 4.0 Newbie : SortedSet<T>

In .NET Framework 4.0 we have a new class called SortedSet<T>. This helps us to sort the elements without explicitly we implementing any sort method. var sSet = new SortedSet<int> { 2, 4, 6, 8, 9, 1, 3, 5, 7 };   //Getting directly the sorted output foreach (int iVal in sSet) {     Console.WriteLine(iVal);… Read more

.NET Framework 4.0 Newbie : StringBuilder.New

In .NET Framework 4.0 we have an option to clear StringBuilder class. Unlike previous versions where we used to write StringBuilder.Length = 0 to clean, now we can implement a new method called Clear().   var sBulder = new StringBuilder();   sBulder.Append(“Anyhting”); sBulder.Append(“Again another”);   //Previous approach to clear up StringBuilder sBulder.Length = 0;  … Read more

.NET Framework 4.0 : Obsolete Types and Members

There are a few obsolete types and members in .NET Framework 4.0. This is an extensive reference for those who write code. Obsolete Types in .NET Framework 4.0 http://msdn.microsoft.com/en-us/library/ee461503(VS.100).aspx Obsolete Members in .NET Framework 4.0 http://msdn.microsoft.com/en-us/library/ee471421(VS.100).aspx Namoskar!!!… Read more