Compiler Warning (level 3) CS0665
Assignment in conditional expression is always constant; did you mean to use == instead of = ?
A conditional expression used the = operator and not the == operator.
The following sample generates CS0665:
// CS0665.cs
// compile with: /W:3
class Test
{
public static void Main()
{
bool i = false;
if (i = true) // CS0665
// try the following line instead
// if (i == true)
{
}
System.Console.WriteLine(i);
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: