This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

<< Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Next >> |
Weak ReferencesWeak References
.NET objects are held in memory, within in the managed heap, until all references are released and the garbage collector removes them. Weak references provide an alternative type of object reference, which may be garbage collected whilst still active.
Waiting for a Process to ExitWaiting for a Process to Exit
.NET applications sometimes need to work with external processes. In some cases it is necessary to wait for those processes to generate results and exit before the .NET software continues executing. Waiting in this way is possible using the Process class.
Forcing Garbage CollectionForcing Garbage Collection
The garbage collector controls memory management automatically, deallocating memory used by unreachable objects periodically but unpredictably. In some situations it can be useful to force an immediate complete or partial garbage collection.
.NET Garbage Collection.NET Garbage Collection
Developers of managed software using the .NET framework do not need to deallocate the memory used by objects when they go out of scope, reducing the risk of creating bugs that cause memory leaks. Release of memory is controlled by the garbage collector.
Obtaining a Stack TraceObtaining a Stack Trace
Call stacks are used to control the flow of programs as methods and properties are executed and terminated. When adding diagnostic code, such as logging, to software it can be useful to examine the call stack for a thread or exception using a stack trace.
Setting the Title for Console ApplicationsSetting the Title for Console Applications
The title bar for a console application that is executed from a command prompt generally shows a default title, rather than the name of the console application. This title can be modified by setting a static property of the Console class.
Lazy Initialisation with Lazy&lt;T&gt;Lazy Initialisation with Lazy<T>
When working with resource intensive objects or types that are slow to instantiate, especially where those objects may not be required, it can be useful to only create the objects when first needed. This technique is known as lazy initialisation.
Obtaining File Version NumbersObtaining File Version Numbers
.NET assemblies can be given three distinct version numbers, each serving a different purpose. It can be useful to obtain these version numbers at run-time. This is made possible with reflection and the use of the FileVersionInfo class.
Console Application Cursor PositionConsole Application Cursor Position
Many console applications are simple programs that output a series of lines of text, scrolling the console window when the available space is filled. However, by manipulating the cursor position, more complex output is made possible.
Using Enum.HasFlagUsing Enum.HasFlag
Prior to version 3.5 of the .NET framework, extracting individual flags from an enumeration required the use of logical bitwise operators. In .NET 3.5, the need for logical operations is removed with the introduction of the Enum.HasFlag method.
<< Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Next >> |