Setup:
Having a dumb day.
I have the following code:
UserRoles = Roles.GetRolesForUser(username);
Problem:
If username is an empty string (“”, user not logged in), then when I check the value of UserRoles in the immediate window it shows:
{string[0]}
Question:
What is {string[0]}?
How can I replicate this value to test my code for the case of an unlogged in user (username == “”)?
NOTE: I have googled for this but to no avail.
GetRolesForUser returns an array of roles, so the “String[0]” in the immediate window just means that it knows the return type is an array (in this case strings), but there are zero entries (since no roles are returned for a blank user.