My first contribution (of many) to the Microsoft Visual C# Developer Center has been published
I have a guest blog entry on Microsoft Canada Developer Connection Community Blog, Uses for the yield keyword in C# 2.0.
C# 2.0 introduced anonymous methods that allow programmers to create a callable block of code that uses parameters but is not declared as a method. One of the places I find this to be most useful is with Invoke and BeginInvoke. Often times, invoking a delegate is used internal to a class to perform asynchronous processing or to ensure code is executed on the GUI thread. Events generally don’t have a particular thread their handlers are run on; it’s up to the code raising the event which thread is used. Code that modifies WinForm control data must be run on the GUI thread. … Continue reading Reducing code-bloat with anonymous methods
.NET has strong support for collections. Even the built-in Array type implements ICollection. The ICollection interface derives from the IEnumerable interface to allow easy enumeration of all elements in a collection. In C#, the foreach statement uses the GetEnumerator member of IEnumerable (a class need not implement IEnumerable, it just needs a public GetEnumerator method that returns an IEnumerator object) to begin enumeration. Previous to C# 2.0 foreach required the existence of the collection and all the elements contained therein, or a custom implementation of IEnumerator.MoveNext() and IEnumerator.Current. Not an entirely unexpected demand, when you think of it. If you … Continue reading Uses for yield Part One – Introduction
I have a Small Business Server 2003 R2 Server running Team Foundation Server tucked out of the way to conserve desk space (three servers, two clients, two desks: not much space). I don’t have it hooked up to a monitor (one: don’t have that many monitors, and two: desk space). So, I’ve been merrily using Remote Desktop Connection (RDC) in Windows XP to connect to this server to perform my various administration tasks (like install service packs, hot fixes, etc.). Well, I finally had a couple of cycles to install some hotfixes for the new daylight savings time changes to various … Continue reading Sudden "…you must have Terminal Server User Access permissions on this computer." Error.