If error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
i'm having a very weird error
i have the following code


if ( ( Name == "SubmitterName" ) || ( Name == "SubmitterWWID" ) )

{ ... }

else

{

target.Attributes[ currentAtt ].Value = "";

}



The problem is that it does not matter if the Name Value is equal to
SubmitterName or to SubmitterWWID, it gets into the else block. I'm using
framework v1.0.
Have anyone out there seen this type of weird error, and knows how to fix it.
or do you know any link where i can point my doubt and try to realize what
is going on?

thanks for your help
 
Not sure I follow. Below works as expected. Remember also that strings
equal compares are case sensitive.
TestName("SubmitterName");
TestName("SubmitterWWID");
TestName("hello");

private void TestName(string name)
{
if ( name == "SubmitterName" || name == "SubmitterWWID" )
{
Console.WriteLine("Name found.");
}
else
{
Console.WriteLine("Not found.");
}
}

-- Output
Name found.
Name found.
Not found.
 
Hi,
i understand your if block, but i've tried with boolean values also, and
returning a value from the function.
It is weird that eventhugh the return value is true...and the condition asks
for a false value, it always get in the if block, i've checked the asembly
and it seems to be ok, i think is more about a weird framwork error. besides
it is not a debugger error, because if i run it on release mode, the output
of the applications behavies wrong also.


William Stacey said:
Not sure I follow. Below works as expected. Remember also that strings
equal compares are case sensitive.
TestName("SubmitterName");
TestName("SubmitterWWID");
TestName("hello");

private void TestName(string name)
{
if ( name == "SubmitterName" || name == "SubmitterWWID" )
{
Console.WriteLine("Name found.");
}
else
{
Console.WriteLine("Not found.");
}
}

-- Output
Name found.
Name found.
Not found.
--
William Stacey, MVP
http://mvp.support.microsoft.com

Luis D Rojas said:
Hello,
i'm having a very weird error
i have the following code


if ( ( Name == "SubmitterName" ) || ( Name == "SubmitterWWID" ) )

{ ... }

else

{

target.Attributes[ currentAtt ].Value = "";

}



The problem is that it does not matter if the Name Value is equal to
SubmitterName or to SubmitterWWID, it gets into the else block. I'm using
framework v1.0.
Have anyone out there seen this type of weird error, and knows how to fix it.
or do you know any link where i can point my doubt and try to realize what
is going on?

thanks for your help
 
Don't know what to tell you. It works here. Post the code.

--
William Stacey, MVP
http://mvp.support.microsoft.com

Luis D Rojas said:
Hi,
i understand your if block, but i've tried with boolean values also, and
returning a value from the function.
It is weird that eventhugh the return value is true...and the condition asks
for a false value, it always get in the if block, i've checked the asembly
and it seems to be ok, i think is more about a weird framwork error. besides
it is not a debugger error, because if i run it on release mode, the output
of the applications behavies wrong also.


William Stacey said:
Not sure I follow. Below works as expected. Remember also that strings
equal compares are case sensitive.
TestName("SubmitterName");
TestName("SubmitterWWID");
TestName("hello");

private void TestName(string name)
{
if ( name == "SubmitterName" || name == "SubmitterWWID" )
{
Console.WriteLine("Name found.");
}
else
{
Console.WriteLine("Not found.");
}
}

-- Output
Name found.
Name found.
Not found.
--
William Stacey, MVP
http://mvp.support.microsoft.com

Luis D Rojas said:
Hello,
i'm having a very weird error
i have the following code


if ( ( Name == "SubmitterName" ) || ( Name == "SubmitterWWID" ) )

{ ... }

else

{

target.Attributes[ currentAtt ].Value = "";

}



The problem is that it does not matter if the Name Value is equal to
SubmitterName or to SubmitterWWID, it gets into the else block. I'm using
framework v1.0.
Have anyone out there seen this type of weird error, and knows how to
fix
it.
or do you know any link where i can point my doubt and try to realize what
is going on?

thanks for your help
 
Hi Luis,

If you use Visual Studio, you might want to try to rebuild the entire
solution.

Now and then I've had weird errors coming from the fact that Visual Studio
thinks the source is up to date when it is not, so hitting F5 does not run
the expected code. Rebuilding the solution will fix this problem.
 
Back
Top