What are the two keywords used to pass a variable by
reference in c#?
Answer Posted / pramod singh
A variable of a reference type does not contain its data
directly; it contains a reference to its data. When you pass
a reference-type parameter by value, it is possible to
change the data pointed to by the reference, such as the
value of a class member. You cannot change the value of the
reference itself; that is, you cannot use the same reference
to allocate memory for a new class and have it persist
outside the block. To do that, pass the parameter using the
ref (or out) keyword. For simplicity, the following examples
use ref.
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is expression c#?
What is serialization in c#?
Why do we need reflection in c#?
What is namespace in oop?
Explain the advantage of using system.text.stringbuilder over system.string?
can you declare an override method to be static if the original method is not static?
What are handlers in c#?
Why do we still see so much non-oo code written in c# today?
How do I create a multi language, multi file assembly?
What is a console file?
What is difference between string and stringbuffer in c#?
Can fields inside a class be virtual?
List down the access modifiers available in c#?
Is boxing an implicit conversion?
What is a static field?