Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is used ref keyword in c#,and how we used it?

Answer Posted / raj093300

ref keyword casues an argument to be passed by reference,not
by value.The effect of passing by reference is that any
change to the parameter in the method is reflected in
undergoing argument variable in the calling argument.The
value of a reference parameter is always the same as the
value of the underlying argument variable...

AS SHOWN IN THIS EXAMPLE...

class sample
{
public static int value(ref int a)
{
a=100;
return a;
}
static void Main()
{
int b=22;
int c=value(ref b);
Console.WriteLine("Output was " +c);
Console.Readkey();
}
}

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is part of a method signature in c#?

899


What is asynchronous one-way calls?

968


How do I calculate relative time?

915


Is c# static or dynamic?

922


How to add controls dynamically to the form using c#.net.

877


What are the applications of c#?

1668


What is thread pooling?

958


What are examples of desktop applications?

956


what happens if you inherit multiple interfaces and they have conflicting method names?

878


What are the 4 pillars of any object oriented programming language?

866


What is uint64_t?

973


Explain what are the steps for creating clr trigger?

877


Which of these string definitions will prevent escaping on backslashes in c#?

989


What does dbml mean?

854


What is expression c#?

900