
- VBForums
- .NET and More
- C#
- [RESOLVED] [2.0] "Not all code paths return a value" error. how to fix this compilation error..
-
Sep 6th, 2006, 09:51 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2.0] "Not all code paths return a value" error. how to fix this compilation error..
I am having a trouble in C# with a very simple method.
the method is supposed to return a boolean value (true or false). Here is the code.
I get compilation error saying that "not all code paths return a value":
public static bool IsMember(List<string> ADGroups)
{
System.Security.Principal.IPrincipal User1;
User1 = System.Web.HttpContext.Current.User;
//check to see if the user trying to access the website is a member of the list of the ActiveDirectory groups that was passed.
foreach (string xx in ADGroups)
{
string sADRole = "fhlbsf-i.com\\"+ xx.ToString();
if ((User1.IsInRole(sADRole) == true))
{
return true;
}
else
{
return false;
}
}

- VBForums
- .NET and More
- C#
- [RESOLVED] [2.0] "Not all code paths return a value" error. how to fix this compilation error..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|