if (this.UserManagmentType != UserMgmtType.NONE)
{
return (User)GetUserBaseById(userId);
}
if (this.UserManagmentType != UserMgmtType.NONE)
{
return GetUserBaseById(userId) as User;
}
I understand the difference between casts. The first if statement should throw an invalid cast exception if the cast fails, while the second will return a null.
For identical data under heavy load in a multi-threaded environment, the first if statement will occasionally return a null, while the second if statement will always return valid data.
The other item of note is that the containing method is a WCF endpoint.
Why would the first if statement ever return null?
Thank you for any insight.