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
Why do we need serialization?
How can I get around scope problems in a try/catch?
What are the fundamental differences between value types and reference types?
What is use of singleton class in c#?
Write a C# program to find the Factorial of n
What is the use of ienumerable?
Is nullable type c#?
What is public or shared assemblies ?
Is stringbuilder thread safe c#?
What are annotations in c#?
How do you define a predicate?
Can constructor be overloaded in c#?
How long has c# been around?
What are extensions in c#?
Is array thread safe c#?