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

Why should I use interface in c#?

968


What is the use of properties window?

993


What is lambda expression in c#?

961


What exception can an overridden method throw in comparison with the method it is overriding?

874


What happens if a static constructor throws an exception?

949


What are "class access modifiers" in C#?

967


What is list array in c#?

871


What are primitive types in c#?

978


Name the control which cannot be placed in mdi?

888


Is visual c# free?

912


Does main have to be static c#?

1075


What is the difference between asp net and c#?

921


What is multicast delegate in c# ?

1040


Explain the importance and use of each, version, culture and publickeytoken for an assembly.

930


What is the difference between returning iqueryable vs ienumerable?

967