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
Can you see a loop recorder?
Differentiate between dataset and datareader?
Explain the difference between private and shared assembly?
What do you understand by 'access specifiers' in C#?
How are Windows programs different from normal C-programs?
Write a sample code to write the contents to text file in c#?
What are the value types in c#?
You are designing a user control. You created new property called backgroundimage which is of type image. You wanted to disable storing this property in the user’s form. How to achieve this?
Why we use methods in c#?
What is asynccallback c#?
How do you access a constant field declared in a class?
What are the types of inheritance in c#?
What is the difference between inheritance and abstract class?
Why do we need indexers in c#?
What is yield keyword?