LINQ Into Microsoft's New Query Capabilities
Query features have long been a cornerstone of database applications, but with LINQ, Microsoft introduces query language features right inside of C# and VB.NET.
free C# Tutorial Starter Kit
The DevelopMentor C# Tutorial Starter Kit delivers a comprehensive tour of the C# language using a sequence of modules, each containing a topic, exercises, and a quiz, with both the "before" and "after" versions of each exercise which allow you to compare your coding solution to the provided solution. It uses a sophisticated, multi-project "starter kit" which includes code samples that compile, documentation, and other helpful resources that help you to work through the C# tutorial, either online or off-line, at your own pace using Visual Studio 2005.
Using P/Invoke to Call Unmanaged APIs from Your Managed Classes
Learn how to use P/Invoke to call unmaged Win32 APIs from managed code. These sample applications show how to mute sounds, change Windows resolution, and display ballon tips from your managed code.
Performance Quiz #9 : IList<T> List and array speed
A short and sweet quiz with lots of juicy discussion possibilities:
public int Sum(IList<ushort> indices)
{
int result = 0;
for (int i = 0; i < indices.Count; i++)
result += indices[i];
return result;
}
Considering only the time it takes to do the Sum (i.e. assuming we had already set up the array/list) which gives better performance and why?
// #1
ushort[] tmp = new ushort[500000]; // this doesn't count
Sum(tmp);// this is what we are timing
OR
// #2
List<ushort> tmp = new List<ushort>(500000); // this doesn't count
for (int i = 0; i < 500000; i++)tmp.Add(0); // this doesn't count
Sum(tmp); // this is what we are timing
What say you gentle readers?
Publisher's Point: C-Sharpest
Exclusive online-only article!Publisher's Point E-Column: C-Sharpest
C# 2.0 just shipped with a number of interesting new features: anonymous methods, nullable objects, iterators, partial classes, generics, and others. But the innovation does not stop there! Microsoft (and Anders Hejlsberg in particular) have already allowed us a sneak peek at some of the new features that will be available in C# 3.0.
How to Create a Web Service in C#
Learn how to create a Web service in C#.
How to Write High-Performance C# Code
Writing code that runs quickly is sometimes at odds with writing code quickly. C.A.R. Hoare, computer science luminary and discoverer of the QuickSort algorithm, famously proclaimed, 'Premature optimization is the root of all evil.' The extreme programming design principle of 'You Aren't Gonna Need It' (YAGNI) argues against implementing any features, including performance optimizations, until they're needed.