S
Steve Richter
this code compiles ok:
public string AssureAnonUID( )
{
if (Session["AnonUID"] == null)
Session["AnonUID"] = Guid.NewGuid();
return Session["AnonUID"].ToString();
}
but this code does not:
public string AssureAnonUID( )
{
Guid guid = (Guid) Session["AnonUID"] ;
if ( guid == null )
{
guid = Guid.NewGuid( ) ;
Session["AnonUID"] = guid ;
}
return guid.ToString( ) ;
}
c:\inetpub\wwwroot\IBuyAdventure\components\stdpage.cs(29): Operator
'==' cannot be applied to operands of type 'System.Guid' and '<null>'
Is that because System.Guid is a struct? If so, how does the object
returned by
Session["AnonUID"]
get converted to the struct by this stmt:
Guid guid = (Guid) Session["AnonUID"] ;
if this is the case, it seems inconsistent.
thanks,
-Steve
public string AssureAnonUID( )
{
if (Session["AnonUID"] == null)
Session["AnonUID"] = Guid.NewGuid();
return Session["AnonUID"].ToString();
}
but this code does not:
public string AssureAnonUID( )
{
Guid guid = (Guid) Session["AnonUID"] ;
if ( guid == null )
{
guid = Guid.NewGuid( ) ;
Session["AnonUID"] = guid ;
}
return guid.ToString( ) ;
}
c:\inetpub\wwwroot\IBuyAdventure\components\stdpage.cs(29): Operator
'==' cannot be applied to operands of type 'System.Guid' and '<null>'
Is that because System.Guid is a struct? If so, how does the object
returned by
Session["AnonUID"]
get converted to the struct by this stmt:
Guid guid = (Guid) Session["AnonUID"] ;
if this is the case, it seems inconsistent.
thanks,
-Steve