Tuesday, 20 May 2014

C# code for how to assign the function or method returns value to the variable




Indroduction

Now I will explain how to assign the function return value to the variable.
Use the below code
Use the below method and return the value
public decimal totalinvbuylists(decimal val1, decimal val2)
        {

            decimal response = val1 * val2;
            return decimal.Round(response, 2, MidpointRounding.AwayFromZero); ;
        }



//Pass the parameter to the method and receve the function returned value assign to the decimal value

//calculation part for totalinvbuylist

decimal Noofunit = Convert.ToDecimal(PM_Noofunit.Text);
decimal Invbuylist = Convert.ToDecimal(PM_Invbuylist.Text);
decimal calctotalinvbuylist = totalinvbuylists(Noofunit, Invbuylist);



I hope this will helpful for you! Thanks.

No comments:

Post a Comment