Difference between Single and First in C#

In the extension methods Single / SingleOrDefault and First / FirstOrDefault have semantic distinction. Though in many places these methods are being used without the semantic consideration, more often they return the expected results. This behavior makes this misuse more common. Both the Single and First methods have an accompanying helper method named as xxOrDefault... Continue Reading →


VS 2013 Preview – New Features

VS 2013 preview is here. It has loads of new cool features. Mainly it comes with the .NET 4.5.1 If you are to develop for Windows 8.1 then you should install VS 2013 preview. This blog post describes some of the cool features in the VS 2013. Immediately after installing the VS 2013 Preview, I... Continue Reading →

AES Cryptography

Contains the code for AES encryption and decryption in C#. 1: public byte [] EncryptText(string plainData) 2: { 3: RijndaelManaged rij = new RijndaelManaged(); 4: 5: rij.GenerateKey(); 6: _key = rij.Key; 7:  8: rij.GenerateIV(); 9: _intializationVector = rij.IV; 10:  11: ICryptoTransform encryptor = rij.CreateEncryptor(_key, _intializationVector); 12:  13: using (MemoryStream msEncrypt = new MemoryStream()) 14: {... Continue Reading →

UI Updates – Part 1

Updating the UI is a problem and it is tricky. There are very few simple rules to follow. Let’s see Here we’ll see  some smart ways to perform UI updates on Console applications, Windows Forms, WPF, ASP.NET, Silverlight, Windows Phone and Windows Store apps. Console Applications Do they have UI ? No. But we’ll check... Continue Reading →

Extension Methods

Extension methods in C# is a great way to add functionality to a closed class. Here the word ‘closed’ refers to both the sealed ones and the classes which you do not have the access to their source code. Some can argue if we can actually add a method to a sealed class then it... Continue Reading →

Powered by WordPress.com.

Up ↑

%d bloggers like this: