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
What is use of singleton class in c#?
In which situation(s), the use of "Delegate" is a good idea?
What is datarelation c#?
Can delegates be used as callbacks?
Why we use get set property in c#?
What are object pooling and connection pooling and difference between them?
What are the types of serialization?
What does static mean in c sharp?
What type of data type conversion happens when the compiler encounters the following code?
What is default constructor in c#?
Name which controls do not have events?
What do you mean by expression tree?
What are the concepts of dispose method?
What is the purpose of abstract class in c#?
What is sorting in c#?