Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

"Return" in C#

Please help me understand why C# throws this error when there's already a return statement there? I can add another return to fix it but why does it do that?

User generated image
This is how I can fix it

public decimal CashBonusBalance
		{
			set {this.label_CashBonusBalance.Text = string.Format("{0:C}",value);}
            get
            {
                if (label_CashBonusBalance != null)
                    return decimal.Parse(label_CashBonusBalance.Text);
                return 0; //**** adding an extra return
            }
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of pepr
pepr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Camillia

ASKER

I understand it now. Thanks

Your model is off.
WinForm code from 2002. This is the least of the problems on this project. I'll fix it, tho.

Thanks for the help, as always.