Feeds:
Posts
Comments

Posts Tagged ‘Code’

.NET RTM 2.0 Bug

Eek, this is pretty bad…. http://codebetter.com/blogs/sahil.malik/archive/2006/01/19/136771.aspx

Read Full Post »

T-SQL Transactions

I do not confess to being a database expert, nor a guru in T-SQL, which is why I have only just found out how crap transactions in T-SQL on SQL Server 2000 can be.  Take a look at the following piece of T-SQL: CREATE TABLE #Foo ( PK int NOT NULL ) CREATE TABLE #Foo2 [...]

Read Full Post »

Jonathan Cogley posts a neat way to trap Javascript errors on a web page, followed by the firing of a server-side exception, so .NET code can be written to email the developer responsible. http://weblogs.asp.net/jcogley/archive/2005/12/07/432584.aspx

Read Full Post »

From C++ to C#

I have gone back in time this week to work on a legacy ISAPI application.  The ISAPI application is being developed in C++ and makes use of MSXML to read an XML configuration file.  Below is some code in C++ to open the XML file and read two text values, contained in element nodes: BOOL [...]

Read Full Post »

String.IsNullOrEmpty

C# 2.0 Tip: You no longer need to write the following code: if (null != someString && someString.Length > 0) { … } Instead you can now just write the following: if (String.IsNullOrEmpty(someString)) { … }

Read Full Post »

The saying goes “you learn something new every day”, and today is no exception.  I’m not sure how I missed this, but never less, this post shows how to gain finer control over adding and removing of event handlers to public multicast delegate events. Typically, most C# developers are used writing event code as follows: [...]

Read Full Post »

LCG Performance

The following are the results of a performance test performed against LCGs, direct function calls, and reflection API invokes.  Each test ran for a number of iterations and produced a mean average time in milliseconds.  The efficiency of the dynamic method delegate (LCGs) calls are calculated as the direct method call time divided by the [...]

Read Full Post »

Reflection and LCG

Anyone who has played with .NET long enough will tell you that Reflection is a really cool feature.  Essentially, reflection enables the developer to query the type system (CLT – Common Language Type system), dynamically invoke methods, and dynamically create types at runtime, using meta-data stored in the .NET assemblies. The reflection API is built [...]

Read Full Post »

Tech Preview: LINQ

This morning I’ve been checking out LINQ – Language Integrated Query from Microsoft, on Channel 9. LINQ enables developers to query any IEnumerable<T> collection  with a simple query, much like that of SQL. Check out the following piece of LINQ code, which queries all the non-static methods supported by System.String, and displays the number of [...]

Read Full Post »

Another nice addition to C# 2.0 is the yield keyword. Yield enables iterator blocks to provide values to an enumerated result, see the following example. // yield-example.cs using System; using System.Collections; public class List { public static IEnumerable Power(int number, int exponent) { int counter = 0; int result = 1; while(counter++ < exponent) { [...]

Read Full Post »

« Newer Posts - Older Posts »

Follow

Get every new post delivered to your Inbox.