Code Snippet posted by:
Satyadevanand | Posted on: 10/18/2012 | Category:
C# Codes | Views: 210 | Status:
[Member] |
Points: 40
|
Alert Moderator
Modifiers for parameters
Ref and Out
class RefOutParams
{
void Withtax(ref decimal amt)
{
amt = amt + (amt * 12.4M / 100);
}
void TaxValue(out decimal tax)
{
tax = 12.4M;
}
static void Main(string[] args)
{
RefOutParams p = new RefOutParams();
decimal amount=50;
p.Withtax(ref amount);
Console.WriteLine(amount);
decimal tax;
p.TaxValue(out tax);
Console.WriteLine(tax);
}