Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
what is te meaning of the ref in nd Out with some practical explanation ? and an example
Posted 20-Aug-12 4:32am
lalitkr1.5K
Comments
ryanb31 at 20-Aug-12 10:51am
   
What language?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

ref- use to pass by reference in function argument
out-similar to ref but pass out value from the function..below example
 
class Test
{
	void refDemo(ref int i)
	 {
		i= i*10;
	 }
        int FindDecimal(float f,out float dp)
	 {
		int i=(int) f;
                dp=f-i;
                return i;
	 }
}
 
class RefExample
{
  public statc void Main(string []args)
   {
	Test obj=new Test();
        int i=10;
	Console.WriteLine("Before Call i:" + i);
	obj.refDemo(ref i);
	Console.WriteLine("After Call i:" + i);
	obj.FindDecimal(12.2345f,out float f);
	Console.WriteLine("Decimal points f:" + f);
   }
}
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

I suggest you read a little bit C# because this question would mean you need some basics covered before jumping to implementation.
 
Here is a very good crash course link. this will also answer your question and cover other basic details too.
 
Quick C#[^]
  Permalink  
Comments
Manas Bhardwaj at 21-Aug-12 9:15am
   
Well said +5
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Don't flood the boards. Buy a book. This is basic stuff, and has NOTHING to do with ASp.NET, nor can we give an example in the language you're using if you don't tell us, but either way, you're asking us to do stuff you can do for yourself. Type your questions in to google. Buy a book. Don't expect us to do it all for you.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 584
1 Maciej Los 275
2 DamithSL 233
3 Sergey Alexandrovich Kryukov 209
4 BillWoodruff 200
0 OriginalGriff 6,803
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,421
3 Manas Bhardwaj 4,841
4 Maciej Los 4,330


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 21 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100