G
Guest
In C++ I'd have something like :-
-------[C++]-----------
DECLARE_HANDLE(MYHANDLE)
class Fred
{
MYHANDLE m_hHandle ;
etc...
}
Fred::Fred()
{
m_hHandle = NULL ;
}
BOOL Create( void )
{
if( m_hHandle != NULL )
{
ASSERT(false)
}
else
{
m_hHandle = SomeFunction() ;
}
}
-------[C++]-------
I now want to do the equivalent in C# (which I'm relatively new to) but cant
see how to do it. So far I've got
-------[C#]-------
namespace
{
using MYHANDLE IntPtr ;
MYHANDLE MyHandle = [What do I put here? null dont work] ;
bool Create()
{
if( MyHandle != null ) <--- Dont work
{ etc
-------[C#]----------
So how do I do the translation to achieve the same functionality ? (other
than adding a bodgybool to say whether MyHandle has been created or not)
TTFN,
Jon
-------[C++]-----------
DECLARE_HANDLE(MYHANDLE)
class Fred
{
MYHANDLE m_hHandle ;
etc...
}
Fred::Fred()
{
m_hHandle = NULL ;
}
BOOL Create( void )
{
if( m_hHandle != NULL )
{
ASSERT(false)
}
else
{
m_hHandle = SomeFunction() ;
}
}
-------[C++]-------
I now want to do the equivalent in C# (which I'm relatively new to) but cant
see how to do it. So far I've got
-------[C#]-------
namespace
{
using MYHANDLE IntPtr ;
MYHANDLE MyHandle = [What do I put here? null dont work] ;
bool Create()
{
if( MyHandle != null ) <--- Dont work
{ etc
-------[C#]----------
So how do I do the translation to achieve the same functionality ? (other
than adding a bodgybool to say whether MyHandle has been created or not)
TTFN,
Jon