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
Write down the c# syntax to catch an exception
Why do we need delegates in c#?
Is array thread safe c#?
Why ref is used in c#?
Why interface is required?
What are All kind of access specifiers for a class and for methods
In c#, what will happen if you do not explicitly provide a constructor for a class?
Where is the keyword void used?
How to sort an int array in c#?
Why do we need properties in c#?
What is the use of main method in c#?
What are the fundamental oop concepts?
Explain the difference between directcast and ctype.
What is the concept of strong names?
Can int be null c#?