C
ChrisB
Hello All:
I have created the following field within a class definition:
Class User
{
// fields
private RoleInfo roleInfo =
RoleInfo.GetRoleInfo(Thread.CurrentPrincipal.Identity.Name);
// remaining class definition
. . .
}
In a method defined in the User class, I attempt to invoke a method on the
roleInfo object:
// method in user class
public static User NewUser()
{
boolean Result = roleInfo.RolePrivilegeInfoCollection.Includes("User",
"Add")
// remaining method
. . .
}
When I attempt to compile the above method, I receive an error message
stating that "roleInfo denotes a field where a class was expected". I
notice that if RoleInfo is instantiated in the NewUser method instead of as
a field within the User class, the code compiles fine - but I would prefer
to only create one instance of RoleInfo that can be used throughout the User
class instead of creating an instance each time it is needed.
Any ideas on what may be causing this error?
Thanks!
Chris
I have created the following field within a class definition:
Class User
{
// fields
private RoleInfo roleInfo =
RoleInfo.GetRoleInfo(Thread.CurrentPrincipal.Identity.Name);
// remaining class definition
. . .
}
In a method defined in the User class, I attempt to invoke a method on the
roleInfo object:
// method in user class
public static User NewUser()
{
boolean Result = roleInfo.RolePrivilegeInfoCollection.Includes("User",
"Add")
// remaining method
. . .
}
When I attempt to compile the above method, I receive an error message
stating that "roleInfo denotes a field where a class was expected". I
notice that if RoleInfo is instantiated in the NewUser method instead of as
a field within the User class, the code compiles fine - but I would prefer
to only create one instance of RoleInfo that can be used throughout the User
class instead of creating an instance each time it is needed.
Any ideas on what may be causing this error?
Thanks!
Chris