C# (Sharp) Programming Language Question:

Download Job Interview Questions and Answers PDF

I was trying to use an "out int" parameter in one of my functions. How should I declare the variable that I am passing to it?

C# (Sharp) Programming Language Interview Question
C# (Sharp) Programming Language Interview Question

Answer:

You should declare the variable as an int, but when you pass it in you must specify it as 'out', like the following:
int i;
foo(out i);
where foo is declared as follows:
[return-type] foo(out int o) { }

Download C# (Sharp) Programming Language Interview Questions And Answers PDF

Previous QuestionNext Question
If a base class has a bunch of overloaded constructors ...How do I make a DLL in C#?