Thank you for your question.
Say you have a big method. This method performs various works step by step. You want to show progress in every stage. You will call this method by a button click like btnCalculateInterest. How you show progress to your calling method. This is not possible by return value in every stage to calling method. You have to perform all the tasks in CalculateInterest method then return. To provide this type solution you need ref.
Example:
private void CalculateInterest(ref int i)
{
i=10;
CalculateLoadAccountsInterest();
i=20;
CalculateDepositAccountsInterest();
i=30;
CalculateCustomerAccountsInterest();
i=40;
CalculateFDRAccountsInterest();
}
protected void btnCalculateInterest_Click(object sender, EventArgs e)
{
int val = 1;
CalculateInterest(ref val );
lblStatus.Text="Progress " + val.ToString() + " percentage or something" ;
}
Thanks,
Mamun