double.IsNaN - What is the compiler doing here

c#

Solution

Structs can have methods.

...

Just incase an example is required:

struct Foo {
    public void Hey ()
    {
        Console.WriteLine("hey");
    }

    public static void DoSomething ()
    {
        Console.Read();
    }
}

Problem

When we do something like `double.IsNaN` -- what exactly is happening? If `double` was a class I would understand it, but double is a struct and it is a value type so how does C# actually call a static method on a value type?

Original source