dotNoted

Icon

Observations of .Net development in the wild

Nice new Visual Studio Orcas feature

The window switch window (Ctrl-Tab by default) in Visual Studio has been updated to show a snapshot of the window you are about to jump to. A very nice little feature to have added… it removes a crucial few seconds from the information seek time, which is more psychological than actual time saved, but each little boost adds up.

 

Filed under: Software Engineering

OdbcFactory.Instance.CreateDataSourceEnumerator does nothing

This method sounds cool – like it would enumerate ODBC sources on a machine.

However, it’s not overridden from its base class, DbProviderFactory, which is implemented like so:

public virtual DbDataSourceEnumerator CreateDataSourceEnumerator()
{
    return null;
}

Filed under: .Net Basics

How to return an empty IEnumerable using yield?

UPDATE:

IEnumerable<Foo> GetFooItems()
{
        yield break;
}

…is what I want.


Given a method that returns an IEnumerable, you can use the C# 2.0 “yield” statement to return the next item in the enumeration. What if you want to return an empty enumeration? The only way I’ve found to do this is the following:

    if (false)
          yield return null;

Any other ideas?

Filed under: .Net Basics