1. What is this? Can this be used within a static method? --- The "this" reference refers to the current object context. Static methods have no context, so it is not valid.
2. Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful? --- The first constructor invokes the base constructor in addition to its own functionality; this would be useful if your base initialized basic field values or had other code that all other constructors would utilize.
3. What is the difference between typeof(foo) and myFoo.GetType()? --- The first returns the object's type at compile time; the second returns it at runtime.
4. What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;} --- Both statements will catch and throw exception, but the latter will preserve the original exception stack.
5. By what mechanism does NUnit know what methods to test? --- Reading attributes defined for classes and methods via reflection.
6. What benefit do you get from using a Primary Interop Assembly (PIA)? --- A PIA is a strongly-named assembly which defines COM interfaces for a component. Because it is strongly-named, it can be loaded into the GAC and verified against the COM component's own signature to give the component collision-protection and authorship-verification benefits when interacing with .NET code.
7. Explain the differences between public, protected, private and internal. --- Public: accessible from any class. Private: accessible only from within the same class. Protected: like private, but derived classes may also access. Internal: like public, but accessible only by code within the same assembly.
8. Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d --- Assembly name -- used for loading. Assembly version -- also used for loading. Culture -- defines culture settings used for string translation and other locale-specific settings. PublicKeyToken -- used to uniquely identify this assembly and prevent collisions.
9. Explain the use of virtual, sealed, override, and abstract. --- Virtual marks a method as overridable. Sealed marks a class as uninheritable. Override redefines a method declared as virtual. Abstract defines a class which cannot be instantiated, or a method which must be overriden in any derived classes.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|