.NET Tip of The Day
Learn one new .NET trick every day
Быстрое пополнение счета телефона      Login or Join

.NET Tips & Tricks Community (ALPHA)

First ... 6 7 8 9 10  ... Last  RSS

Get rid of unused usings

In a Visual Studio 2008 source window, right-click and select Organize Usings | Remove Unused Usings. Visual Studio 2005 users may use ReSharper for this.

 

P.S. interesting, does this optimization gives you any benefits other than cleaner code?

submitted by kostya.ly
5/12/2008

Capitalization of ID and OK abbreviations used in identifiers

I was wondering how to capitalize properties which have either ID or OK abbreviation in its name. For example, is it TipID or TipId? I have found the answer in Design Guidelines for Developing Class Libraries:

In Pascal-cased identifiers (all identifiers except parameter names) they should appear as Id, and Ok. If used as the first word in a camel-cased identifier, they should appear as id and ok, respectively.

 

P.S. And of course .NET Framework doesn't fulfil this rule :) For example, Control.ClientID property.

submitted by kostya.ly
5/7/2008

How to loop through all rows of the DataTable?

foreach (DataRow row in dTable.Rows)

{

yourvariable = row["ColumnName"].ToString();

}

 

//OR

for (int j = 0; j< dTable.Rows.Count; j++)

{

yourvariable = dTable.Rows[j]["ColumnName"].ToString()l

}

 

submitted by Raja
4/30/2008

To avoid line by line debug using F11

Use DebuggerStepThroughAttribute

 [System.Diagnostics.DebuggerStepThrough()]

public void sample()

{

// ....

}

 

submitted by dhanaid
4/29/2008
First ... 6 7 8 9 10  ... Last  RSS
RSS .NET Tip of The Day
Subscribe to receive one tip from the .NET Tips and Tricks Community per day.
Previous Tips of The Day
The best of the .NET Tips & Tricks Community.
.NET Practitioners .NET Tips & Tricks Community
Every .NET practitioner has a trick up in their sleeve. This is the place to share it with other .NET people.
Submit a Tip
Discovered a new trick? Share it with others.
My Tips
Manage tips you authored.