setting a global bool in OnSuccess error

0 votes
Assets/script/appMono/appA42serviceManager.cs(66,41): error CS0038: Cannot access a nonstatic member of outer type `appA42serviceManager' via nested type `appA42serviceManager.AppCallBack_createUser'
the error points to the global boolean flag: bUserCreateOnSuccess_daniel.
 
my code snippet:

public void OnSuccess(object oResponse){

User user = (User)oResponse;

string sUserName = user.GetUserName();

switch(sUserName){

case "daniel":{

bUserCreateOnSuccess_daniel = true;

}break;

}

daniel

asked May 21, 2014 in App42 Cloud API-BaaS by mrdaniel (10 points)

1 Answer

0 votes

That's because the NestedClass(appA42serviceManager.AppCallBack_createUser) cannot access the non-static, member bUserCreateOnSuccess_daniel  declared in the OuterClass(appA42serviceManager). The members of the OuterClass(appA42serviceManager) are not directly available to the NestedClass(appA42serviceManager.AppCallBack_createUser). Well, then how can the NestedClass access the members of the containing class? This is how:

 

public void OnSuccess(object oResponse){

User user = (User)oResponse;

string sUserName = user.GetUserName();

switch(sUserName){

case "daniel":{

appA42serviceManager.bUserCreateOnSuccess_daniel = true;

}break;

}

answered May 21, 2014 by Akshay.Mishra (179 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...