What are the two keywords used to pass a variable by
reference in c#?
Answers were Sorted based on User's Feedback
Answer / sreekanth m
Two keywords are "ref" and "out".
the difference between them are: In the case of "ref", the
passed argument should be initialized first whereas
for "out", its not mandatory.
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / 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 |
Is it possible to have a static indexer in c#? Allowed in c#.
When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?
What is a namespace server?
C# called c sharp why?
What is fcl in c#?
What is difference between private, protected, and public in C#?
Constructor to an arbitrary base constructor?
What is hash c#?
What you mean by delegate in c#?
What do you understand by an Implicit Variable?
When would you use generics in your code c#?
Explain concurrency with aop?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)