When is a giraffe not a giraffe? I hope this kind of "riddle" is ontopic in Programming Puzzles &amp; Code Golf.

Give an example of a situation where the C# method below returns false:

public class Giraffe : Animal
{
  public bool Test()
  {
    return this is Giraffe;
  }
}


Rules: The code lines above must not be changed in any way, but you would put the code into an application so that the "project" compiles and the method is called. When run, the method must return false. The solution I have in mind, does not emit its own IL at run-time or similar "exotic" things, it's an ordinary instance method call.
Yay, found it!

public class Animal
{
    public class Giraffe { } // 1
}
public class Giraffe : Animal // 2
{
    public bool Test()
    {
        return this is Giraffe;
    }
}


Since Giraffe 1 is a member of Animal, and Giraffe 2 is one level further out, the name Giraffe in the is test refers to the former (section 7.6.2 in the C# 5 spec).

Visual Studio shows a warning for this is Giraffe:


  The given expression is never of the provided type


which is obviously true, since it's the whole point :)

You cannot put Giraffe 1 directly inside Giraffe 2, because


  member names cannot be the same as their enclosing type


&ndash; but such a rule does not exist for derived classes.

Neat problem, took me a while.