Question: By mistake I wrote

```
Equals( s1, s2 );

```

instead of

```
string.Equals( s1, s2 );

```

and the MS VS compiler compiled the code successfully.

Why did the compiler find static method Equals? Is it a bug of the compiler?

For example you may write

```
Console.WriteLine("compare {0} to {1}: {2}",
    s1, s2, Equals( s1, s2));

```

but you may not write

```
Console.WriteLine("compare {0} to {1}: {2}",
    s1, s2, Compare(s1, s2));

```

EDIT:
It seems that static function Equals calls non-static member function Equals that can be overwritten in each derived class. So the question is where to see the definition of static function Equals of class object?

Answer: 
Because all classes inherits an `Equals` method from Object class. That's the method you are calling in the first example.

You can omit the class name because you are in the context of `object` class. Consider this simple example:

```
public class Foo
{
    public static void FooMethod() { }
}

public class Bar : Foo
{
    public Bar()
    {
        FooMethod();
    }
}

```

Here you can call `FooMethod` by omitting the class name because `Bar` inherits from `Foo`.

---

I don't know where is this specified in the specs exactly (omitting the class name when calling a static method in derived class), but you can have a look at [this documentation](http://msdn.microsoft.com/en-us/library/ms173149.aspx).It says:

> 
> When you define a class to derive from another class, the derived class implicitly gains all the members of the base class, except for its constructors and destructors. The derived class can thereby reuse the code in the base class without having to re-implement it.
> 
> 
> 

Also notice the table in there:

![enter image description here](https://i.stack.imgur.com/MSkiX.png)

You can see that both classes inherits from object and it's members. Also if you look at the example you can see that they are also omitting the class name when calling the base class method, in the second constructor of `ChangeRequest` class.

```
public ChangeRequest(string title, string desc, TimeSpan jobLen,
                     int originalID)
{
    // The following properties and the GetNexID method are inherited  
    // from WorkItem. 
    this.ID = GetNextID();
    ...
}

```
I will answer my question myself.

Static method `Equals` within its body calls virtual non-static method `Equals`. As this non-static method `Equals` is overwritten for class `string` then the static method makes correct comparison.
The static method is called without class name because all claeses are derived from class object.