B
Bob Gregory
Hi all, I'm utter C# newbie, do be gentle.
VS2005 Express refuses point blank to install on my box, so I'm stuck
with C# 1.0 unless someone can point me to a C#2.0 compiler elsewhere.
I have an authentication system rigged up, which is working, but I'd
like to be able to run a test like this
<code>
user thisUser = UserDirectory.GetUserByUsername(Username);
if(thisUser==null){
// user does not exist
}
else{
// do password tests, fetch roles etc.
}
</code>
but the conditional fails 'cos I can't compare type user and <null>.
I've compromised by returning an empty user object and then testing
<code>
if(thisUser.username == null){
// etc. etc.
}
</code>
which works but /smells/ wrong... is there a better way? Will the
nullable types in C# 2.0 let me do this?
Cheers for any advice you can offer,
-- Bob
VS2005 Express refuses point blank to install on my box, so I'm stuck
with C# 1.0 unless someone can point me to a C#2.0 compiler elsewhere.
I have an authentication system rigged up, which is working, but I'd
like to be able to run a test like this
<code>
user thisUser = UserDirectory.GetUserByUsername(Username);
if(thisUser==null){
// user does not exist
}
else{
// do password tests, fetch roles etc.
}
</code>
but the conditional fails 'cos I can't compare type user and <null>.
I've compromised by returning an empty user object and then testing
<code>
if(thisUser.username == null){
// etc. etc.
}
</code>
which works but /smells/ wrong... is there a better way? Will the
nullable types in C# 2.0 let me do this?
Cheers for any advice you can offer,
-- Bob