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 are some examples of desktop applications?

934


What is the difference between select and selectmany?

941


What is difference between property and variable in c#?

877


Is list immutable in c#?

878


What does int32 mean in c#?

904


Can an array be null c#?

941


What is a type c#?

972


Explain About namespaces

984


What is difference between field and property in c#?

835


Explain how to implement delegates in c#.net

960


What is Private Constructor? and it’s use? Can you create instance of a class which has Private Constructor?

983


What is the syntax for calling an overloaded constructor within a constructor?

964


What are events in C#?

986


Where static variables are stored?

949


What is stringreader in c#?

884