Thanks Nishant and Tian for looking into this for me!
I did another test (one I didn't think about, but wish I
had). I wrote this snippet of code (included at the
bottom of the post, with error message below as well) that
illustrates the problem. Then I got a copy of VC++ 2003
(we're not able to use it in production yet so I wasn't
using it) and tried it there...and it worked. So i'm
guessing it's a problem with VC++ 2002. Is there a
way/workaround in 2002 that I can use without converting
it to a string and doing a string compare?
Thanks again!
Chad
#include "stdafx.h"
#using <mscorlib.dll>
#include <tchar.h>
using namespace System;
using namespace System::Collections;
int _tmain(void)
{
Stack * s = new Stack();
s->Push(__box(true));
Object * o = s->Pop();
try
{
Boolean b = *dynamic_cast<__box Boolean*>(o);
Console::WriteLine(b);
}
catch (Exception * e)
{
Console::WriteLine(e->ToString());
}
Console::WriteLine("Press any key to continue");
Console::Read();
return 0;
}
"System.NullReferenceException: Object reference not set
to an instance of an object.
at main() in c:\projects\vc2002
\boolcasttest\boolcasttest.cpp:line 22"
-----Original Message-----
Hi Chad,
Nish is correct and, based on my experience, I did not
find any known issuethat dynamic_case does not work for BOOL value.
For further research, would you please tell us the
detailed error messageyou received? Could you post some code snippet which is
able to reproducethe problem? I will be glad to check it on my side.
I look forward to hearing from you.
Have a nice day!
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and
confers no rights.
.