Jun 20, 2007

Design Guidelines for Class Library Developers

The .NET Framework's managed environment allows developers to improve their programming model to support a wide range of functionality. The goal of the .NET Framework design guidelines is to encourage consistency and predictability in public APIs while enabling Web and cross-language integration. It is strongly recommended that you follow these design guidelines when developing classes and components that extend the .NET Framework. Inconsistent design adversely affects developer productivity. Development tools and add-ins can turn some of these guidelines into de facto prescriptive rules, and reduce the value of nonconforming components. Nonconforming components will function, but not to their full potential.

These guidelines are intended to help class library designers understand the trade-offs between different solutions. There might be situations where good library design requires that you violate these design guidelines. Such cases should be rare, and it is important that you provide a solid justification for your decision. The section provides naming and usage guidelines for types in the .NET Framework as well as guidelines for implementing common design patterns.

Read more: I have delicious Design Guidelines for Class Library Developers.

What is the difference between const and static readonly?

The difference is that the value of a static readonly field is set at run time, and can thus be modified by the containing class, whereas the value of a const field is set to a compile time constant.

In the static readonly case, the containing class is allowed to modify it only

· in the variable declaration (through a variable initializer)
· in the static constructor (instance constructors, if it's not static)

static readonly is typically used if the type of the field is not allowed in a constdeclaration, or when the value is not known at compile time.

Instance readonly fields are also allowed.

Remember that for reference types, in both cases (static and instance) the readonly modifier only prevents you from assigning a new reference to the field. It specifically does not make immutable the object pointed to by the reference.

class Program
public static readonly Test test = new Test();

static void Main(string[] args)
test.Name = "Program";
test = new Test(); // Error: A static readonly field cannot be assigned to (except in a static constructor or a variable initializer)

class Test
public string Name;

On the other hand, if Test were a value type, then assignment to test.Name would be an error.

Jun 14, 2007

Create .NET documentation with Microsoft's Sandcastle

Hello all,

This is post for developers who are using xml comments.

The .NET Framework allowed C# developers to use XML-style comments in their code. This feature was added to VB.NET with version 2.0. The compiler can use these comments to generate basic technical documentation. The end result of using the XML commenting feature is a large XML file that is less than user friendly

How to get Sandcastle

The latest version of Sandcastle is available via href="">Microsoft's
March 2007 Community Technology Preview
. You may install and run it on
Windows Server 2003 or Windows XP Service Pack 2. It requires the href="
Framework 2.0
, as well as the href="">HTML
Help Workshop
. Once the prerequisite software is installed, you can install
the Sandcastle tool.

I also have delicious Create .NET documentation with Microsoft's Sandcastle .

Implement full text search using Stored procedures

Hello friends,

While working with Full-Text search, I come to situation where I have to write script which creates the catalog, enable it and start population on it.

Then I found there are stored procedures in master database only, which can usefull to craete, enable and populate the Full-Text Catalog in SQL Server.

Have a look at Implement full text search using Stored procedures.

Look at Help With Full-Text Catalogs - Stored Procedures are available too.

Jun 11, 2007

Problem with IIS??


I found many of .NET developer are having problem in configuring IIS specially IIS 7.

Have a look at this delicious, it helps you lots when you stuck-up in IIS configuration.

Jun 9, 2007

What is Microsoft Silverlight

Microsoft® Silverlight™ is a cross-browser, cross-platform plug-in for delivering the next generation of .NET based media experiences and rich interactive applications for the Web. Silverlight offers a flexible programming model that supports AJAX, VB, C#, Python, and Ruby, and integrates with existing Web applications. Silverlight supports fast, cost-effective delivery of high-quality video to all major browsers running on the Mac OS or Windows.

Read more

Components of the WSDL File

definitions: The root element of the WSDL file. This area contains namespace definitions that you use to avoid naming conflicts between multiple web services.

types: (not shown) Defines data types used by the service's messages.

message: Defines the data transferred by a web service operation, typically the name and data type of input parameters and return values.

port type: Defines one or more operations provided by the web service.

operation: Defines an operation that can be remotely invoked.

input: Specifies an input parameter to the operation using a previously defined message.

output: Specifies the return values from the operation using a previously defined message.

fault: (not shown) Optionally specifies an error message returned from the operation.

binding: Specifies the protocol used to access a web service including SOAP, HTTP GET and POST, and MIME.

service: Defines a group of related operations.

port: Defines an operation and its associated inputs and outputs.

Escape Characters in JavaScript!!!

Hello all,

I found the list of escape characters which you can use in java script for giving stylish message to end user.


Event Bubbling

Event bubbling is the process of moving an event up the control hierarchy, from a control low in the hierarchy - such as a Button within the row of a DataGrid - and percolating it up to an ancestor control - such as the DataGrid.

Read more

Check that the SMTP server accepts email

Follow these steps to simulate what FogBugz does when it tries to send mail. If you see an error at any point, it will likely give you some clues as to what's wrong with the SMTP server.

From the computer where FogBugz is running, open a command prompt (choose Start, Run, type cmd, and click OK).

telnet smtpserver 25

If you get a message that says something like Connect Failed, the SMTP server in question is not accepting any connections. This may be because:
the SMTP server is not running
the SMTP server is configured to reject email connections from the FogBugz machine
If all is well, you will see a message that starts with the number 220 followed by a greeting.

HELO smtpserver

You should see a message starting with the number 250 followed by something glib like "pleased to meet you"
Using the email address configured as "Notification Return Address" in the FogBugz Site configuration screen, type


You should see a message starting with the number 250 followed by something like Sender ok.
Using the email address you want to send a notification to, type


You should see a message starting with the number 250 followed by something like Recipient ok.

If you see a message that says something like "Relay Access Denied" -- this means that the SMTP server is configured to refuse any email that is not intended for its own domain. For example if you are sending mail to using an SMTP server at and you see a message about relaying denied, this SMTP server probably thinks you are a spammer. You will need to find an SMTP server that is configured to accept email from the FogBugz machine to its recipients.


You should see a message starting with the number 354 followed by instructions to enter the email message..
Test message

Note that the last line contains a period (dot) alone. This signals that you are done typing the message.
You should see a message starting with the number 250 followed by something like Message Accepted for Delivery.

Check that the email was received. If it was not received even though the message was accepted for delivery, there is something wrong with the SMTP mail server.

Jun 1, 2007

Cannot convert null to 'int' because it is a value type

Hello friends,

I found solution for the following error:

Cannot convert null to 'int' because it is a value type

when i wrote

int i = null

Now we can assign null values to such value types viz. int, datetime, float...

Check out Nullable Types