Logo 
Search:

.Net Framework Interview FAQs

Submit Interview FAQ
Home » Interview FAQs » .Net FrameworkRSS Feeds
.Net Framework
Comments: 0

How do I prevent concurrent access to my data?

Each object has a concurrency lock (critical section) associated with it. The System.Threading.Monitor.Enter/Exit methods are used to acquire and release this lock. For example, instances of the following class only allow one thread at a time to ente...
Posted By:Eric Foster      Posted On: Oct 30

.Net Framework
Comments: 0

Should I use ReaderWriterLock instead of Monitor.Enter/Exit?

Maybe, but be careful. ReaderWriterLock is used to allow multiple threads to read from a data source, while still granting exclusive access to a single writer thread. This makes sense for data access that is mostly read-only, but there are some cavea...
Posted By:Oliver Evans      Posted On: Feb 04

.Net Framework
Comments: 0

Is there built-in support for tracing/logging?

Yes, in the System.Diagnostics namespace. There are two main classes that deal with tracing - Debug and Trace. They both work in a similar way - the difference is that tracing from the Debug class only works in builds that have the DEBUG symbol defin...
Posted By:Geb Chalthoum       Posted On: Sep 19

.Net Framework
Comments: 0

Can I redirect tracing to a file?

Yes. The Debug and Trace classes both have a Listeners property, which is a collection of sinks that receive the tracing that you send via Debug.WriteLine and Trace.WriteLine respectively. By default the Listeners collection contains a single sink, w...
Posted By:Corey Brown      Posted On: Nov 09

.Net Framework
Comments: 0

Can I customise the trace output?

Yes. You can write your own TraceListener-derived class, and direct all output through it. Here's a simple example, which derives from TextWriterTraceListener (and therefore has in-built support for writing to files, as shown above) and adds timing i...
Posted By:Fred Hicks      Posted On: Feb 06

.Net Framework
Comments: 0

Are there any third party logging components available?

Log4net is a port of the established log4j Java logging component.
Posted By:Ludo Ricci      Posted On: Sep 03

  6  7  8  9  10  11  12  13