Symptoms
You are seeing the following error in the console window:
error CS0118: `__' is a `__' but a `__' was expected.
Cause
This error is caused when a construct is not used correctly, or a disallowed operation was tried on a construct.
In the script below, I try to pass a namespace into a function. This then displays the CS0118 error as I am incorrectly using a namespace by passing it into a function.
The error this example presents:
error CS0118: `Helper' is a `namespace' but a `type' was expected.
Resolution
The resolution is to use the correct construct (In this example a Type) or find an alternative way to use the construct (In this example a namespace).
I've fixed this example by accessing DisplayCredits() without passing it into the function.
More Information
https://msdn.microsoft.com/en-us/library/fzc6hyft(v=vs.90).aspx
Comments
0 comments
Article is closed for comments.