Hi
I have this if statement -
if (!((main.property == 1)||(main.property == 2)))
{
...
}
main.property is a byte which is either 0, 1, 2 or 98.
Visual studios says that this statement is always true but I can't see why?
If the property is 1 or 2 shouldn't this be false.
Thank you in advance.
Edit: Added code
file1.cs
private void Upload(DataSet ds)
{
Main main = CreateMain(ds); //This is tested and works correctly
if(ValidateDate(main))
{
...
}
}
file2.cs
internal static bool ValidateData(Main main, ...)
{
if (!((main.property == 1)||(main.property == 2)))
{
...
}
}
Edit: Added code
If I do this the error goes away -
internal static bool ValidateData(Main main, ...)
{
main.property = 0; //Or = any number
if (!((main.property == 1)||(main.property == 2)))
{
...
}
}
I'm guessing VS thinks it isn't initialised but I am 100% positive it is.