Set - 2

Question 6 :

Is XML case-sensitive?

Answer :

Yes, so and are different elements.


Question 7 :

If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?

Answer :

Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.


Question 8 :

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?

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) { }


Question 9 :

How do I make a DLL in C#?

Answer :

You need to use the /target:library compiler option.


Question 10 :

How do I simulate optional parameters to COM calls?

Answer :

You must use the Missing class and pass Missing.Value (in System.Reflection) for any values that have optional parameters.