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 >> |
Identifying the Default Comparers for a TypeIdentifying the Default Comparers for a Type
When creating methods that perform comparison or sort operations, it is usual to allow callers to use a default comparer, a standard .NET comparers or a custom class. For generic methods, it is essential to be able to obtain a default comparer for a type.
Implementing IComparer&lt;T&gt;Implementing IComparer<T>
The generic IComparer<T> interface was introduced with the .NET framework version 2.0. It is used to compare two values to determine which is the larger. The interface is used in many standard .NET methods, particularly those that sort information.
Implementing IEqualityComparer&lt;T&gt;Implementing IEqualityComparer<T>
IEqualityComparer<T> is a generic interface defined in the .NET framework version 2.0 and used in many standard classes, including several LINQ operators. The interface can be implemented to allow customised comparison of values and objects.
Obtaining the Week Number for a DateObtaining the Week Number for a Date
Accounting software, time-keeping utilities and calendar applications often present dates using week numbers that commence at the beginning of the year. Using the .NET framework's Calendar class a week number can be calculated using a number of rules.
Formatting Enumeration ConstantsFormatting Enumeration Constants
Enumerations provide useful groupings of named, numeric constants that can enhance the readability of source code. When the constants need to be outputted they may be formatted as numbers or strings, with various available options.
Getting a Base ExceptionGetting a Base Exception
When using a pattern where caught exceptions are wrapped within new exceptions and rethrown, it may be necessary to examine the originating exception object. The Exception class includes a method that makes this simple to achieve.
Generic Variance in .NET 4.0Generic Variance in .NET 4.0
With the release of .NET 4.0, Microsoft introduced covariance and contravariance to generic interfaces and delegates. Generic variance allows conversion and interchangeability of types in a logical manner that was not previously possible.
IDisposable and Thread SafetyIDisposable and Thread Safety
The IDisposable interface should be applied to classes that hold unmanaged resources, either directly or indirectly. When developing using parallel programming or multi-threading techniques, IDisposable should be implemented in a thread-safe manner.
.NET Math Library.NET Math Library
The .NET framework includes a class named "Math", which provides a number of standard mathematical functions, using static methods, and mathematical values, using simple constants. This article describes all of the Math class members.
C# Runtime CompilationC# Runtime Compilation
The .NET framework includes classes that allow the code generator and compiler to be controlled from within an assembly. This allows C# source code, held in a string array, to be compiled at run time and executed using basic reflection techniques.
<< Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Next >> |