In Main function another function is there and to that
function if we pass string as parameter ,then that string
value is passed by value or reference type?

Answer Posted / sultan

parameters are passed byvalue unless defined to be passed
as ref,

try this
inside MAIN
{
string a = "a";
console.writeline(a);
foo(a);
console.writeline(a);
foo1(ref a);
console.writeline(a);
console.readkey();
}

foo(string a)
{
a="b";
}
foo1(ref string a)
{

}
}

result:
a
a
b

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the role of Garbage collector and its generations?

514


How many parameters can a method have c#?

479


What is the difference between ienumerable and enumerable?

447


What is poco c#?

477


What is the usage of transponders?

537






What is a interface in c#?

468


Explain About DTS package

574


What is asp net c# corner?

787


How to use session under class file of APP_Code folder?

511


Define property in c#.net?

515


Is boxing an implicit conversion?

535


What is state c#?

430


What is executenonquery c#?

460


What is #region in c#?

498


What is a decimal in c#?

494