Click here to Skip to main content
15,907,875 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I have one C# code as below:
C#
internal int Calc(double bbMacd, double avg, double upperBand, double lowerBand, double smallTrigLine, double largeTrigLine, double smallTrigLineAvg, double largeTrigLineAvg, int keltnerDir, double keltnerTop, double keltnerMid, double keltnerBot, double supVal, double resVal, out bool LMacdOK, out bool SMacdOK)
		{
			bool item;
			bool flag;
			bool flag1;
			bool flag2;
			bool flag3;

Some calculation here

bool& lMacdOK=LMacdOK;
			if (flag4 || flag5)
			{
				flag2 = true;
			}
			else
			{
				flag2 = flag7;
			}
			*(lMacdOK) = flag2;
			bool& sMacdOK=SMacdOK;
			if (flag4 || flag5)
			{
				flag3 = true;
			}
			else
			{
				flag3 = flag6;
			}
			*(sMacdOK) = flag3;
			return 1;
		}
	}
}


After compile get below errors:
Identifier expected Error CS1001. I got this error for below two lines:
bool& lMacdOK=LMacdOK;
bool& sMacdOK=SMacdOK;

How to solve this?
Regards,
Posted
Comments
[no name] 26-Dec-12 9:00am    
Can you please explain what is bool& in "bool& lMacdOK=LMacdOK;" ?
Rezame 26-Dec-12 9:01am    
I have one code trying to modify that.
[no name] 26-Dec-12 9:29am    
Yes your code is wrong there...
Change your code there and you will get your result...

1 solution

bool& is an invalid syntax in C#

I don't know what you want to achieve.

Read the link for error definition Click[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900