Archive for .NET

You are browsing the archives of .NET.

DataRow[DataColumn] performance enhancements

Since the system I work on performs about 1000 DataTable specific manipulations per minute, I’ve been going through and working out some ways to speed it up that little bit more. Take the following code:
DataTable myData = new DataTable();
myData.ReadXml(“myxml.xml”);
if (myData.Rows[0].IsNull(“column1″))
    return null;
else
    return myData.Rows[0]["column1"];
The obvious performance improvement here is to first pull out the column [...]

Visual Studio 2008 Editions Comparison

When it comes to deciding which Visual Studio version you should use (aside from the issue of which MSDN subscription you purchased or how much money you have to throw at Visual Studio) there are some very big differences between versions that you might find yourself leaning towards more or less than others.
I have used [...]

Request.Url using SSL

A lesson learned the hard way: browsers do not post referring URL information to a HTTPS connection, and it looks like there may some more spanners in the works preventing Request.URL from providing the correct URL. This makes sense in the fact that the headers aren’t necessarily secure – Firefox for example had a long [...]

SqlCommand.Cancel before SqlDataReader.Close

I’ve just read that you can improve the performance of your SQL queries to Microsoft SQL Servers using .NET 2.0 by simply cancelling the command before closing your data reader.
using (SqlCommand command = connection.CreateCommand())
{
// Your code here
using (SqlDataReader reader = command.ExecuteReader())
{
// Your code here
command.Cancel();
reader.Close();
}
command.Close();
command.Dispose();
}
This is useful if you do not need the return values sending [...]