Nullable Type in C#

Saturday, January 30th, 2010

Nullable type in C#
We can declare a variable as nullable when we want to know that a value has been assigned to that variable or not. Declaring a variable as nullable enables the HasValue and Value members. We can use the HasValue property on the variable to check if the value has been assigned to [...] Read more »

Anonymous Constructor in C#

Monday, August 17th, 2009

C# 3.0 introduced a very compact way of initializing objects of a class.
Previously we used to initialize objects like this:

MailMessage mailMessage = new MailMessage();
mailMessage.Subject=UIConstants.UIErrorSubject;
mailMessage.Body = message;
[...] Read more »

Regular Expression for alphanumeric password in C#

Wednesday, August 5th, 2009

The task at hand is to validate the Textbox in asp.net for a valid password which should be an alphanumeric string consisting of numbers and alphabets only. It should have atleast 1 number and 1 a
We can attach a RegularExpressionValidator to the text box with the following regular expression: Read more »

Creating a New Xml Document from Scratch in C#

Monday, April 20th, 2009

To create a new XmlDocument, start by creating an XmlDocument object. The XmlDocument object contains CreateElement and CreateAttribute methods that are used to add nodes to the XmlDocument object. The XmlElement contains the Attributes property, which is an XmlAttribute-Collection. The XmlAttributeCollection inherits from the XmlNamedNodeMap class, which is a collection of names with corresponding values.
The [...] Read more »