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
Explain the difference between user control and custom control. Also, explain their use.
What are sorted lists?
Explain the importance and use of each, version, culture and publickeytoken for an assembly.
what is an exception in .net?
What is the difference between package and interface?
Name any three ways to pass parameters to a method in c#?
What is difference between variable and property in c#?
What is console application with example?
Can derived classes have greater accessibility than their base types?
What is lock in c#?
What is the system namespace?
How can I access the registry from c# code?
Does c# have functions?
Why do we use void in c#?
Why can’t struct be used instead of class for storing entity?