Interview FAQs

A control is a component that provides user-interface (UI) capabilities.
A connection pool is a collection of connections which are shared between the clients requesting one. Once the connection is closed, it returns back to the pool. This allows the connections to be reused.
GAC is a machine-wide cache of assemblies that allows .Net applications to share libraries. GAC solves the problems associated with dll (DLL Hell).
It is the ability to monitor an application so that information about the applications progress, performance and status can be captured and reported.
The process of examining the source code generally through a peer, to verify it against best practices.
Logging is the process of persisting information about the status of an application.
Strictly speaking you can not, since const can only be applied to a field or local whose value is known at compile time.

In both the lines below, the right-hand is not a constant expression (not in C#).

const int [] constIntArray = newint [] {2, 3, 4};
// error CS0133: The expression being assigned to constIntArray must be constant
const int [] constIntArrayAnother = {2, 3, 4};
// error CS0623: Array initializers can only be used in a variable or field
//initializer. Try using a new expression instead.

However, there are some workarounds, depending on what it is you want to achieve.

If want a proper .NET array (System.Array) that cannot be reassigned, then static readonly will do for you.

static readonly int [] constIntArray = new int[] {1, 2, 3};

The constIntArray field will be initialized before it its first use.

Use the System.Environment class. Specifically the GetEnvironmentVariable and SetEnvironmentVariable methods.

Admitedly, this is not a question specific to C#, but it is one I have seen enough C# programmers ask, and the ability to set environment variables is new to the Whidbey release, as is the EnvironmentVariableTarget enumeration which lets you separately specify process, machine, and user.

PreviousDisplaying 25 of 46Next
Need Help? Contact Us.

Log in


Forgot password?


New User