What does the C# compiler mean when it prints "an explicit conversion exists"?
- by Wim Coenen
If I make an empty test class:
public class Foo
{
}
And I try to compile code with this statement:
Foo foo = "test";
Then I get this error as expected:
Cannot implicitly convert type 'string' to 'ConsoleApplication1.Foo'
However, if I change the declaration of Foo from class to interface, the error changes to this (emphasis mine):
Cannot implicitly convert type
'string' to 'ConsoleApplication1.Foo'.
An explicit conversion exists (are you
missing a cast?)
What is this "explicit conversion" which is supposed to exist?