C#

roger's picture

Odd behaviour with WCF base addresses and HTTP.SYS wildcards

I'm at DevWeek this week, and I went (among other things) to a couple of WCF presentations by Aaron Skonnard.

So, anyway, last night I put together a really simple WCF service. It looks like this:

roger's picture

Generating the Fibonacci sequence by using the yield keyword, non-recursively

class FibonacciSequence : IEnumerable
{
    public IEnumerator GetEnumerator()
    {
        yield return (long)0;
        yield return (long)1;

        long prev = 0;
        long curr = 1;

        for (; ; )
        {
            long next = prev + curr;
            if (next < 0)   // It overflowed. Stop.
                yield break;

            yield return next;
            prev = curr;
            curr = next;
        }
    }
}

roger's picture

Calling C# from JScript

It's possible, through the magic of COM interop, to call C# code from JScript or VBScript. Here's an example of how to do it from JScript.

roger's picture

Using PropertyGrid with a dictionary object

If you try using IDictionary with the PropertyGrid control, the results aren't spectacular:

Here's how to do it properly.

roger's picture

Implementing a Wizard in C#, Part 2

In this installment (see here for the previous installment), we'll be fixing a few things and making the whole thing prettier.

roger's picture

Implementing a Wizard in C#

Oddly, the Windows Forms libraries don't provide any support for writing wizards. Here's one way to do it.

roger's picture

Implementing a paged Options dialog

Several popular applications implement their options dialog as a collection of pages. Here's one way to do this in your application.

Syndicate content