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 | 9 | 10 | 11 | 12 | Next >> |
C# Event AccessorsC# Event Accessors
Events can easily be added to classes to allow objects to indicate when an action occurs. Using standard declarations, multiple subscribers can be added to a single event. To increase the level of control over subscriptions, you can use event accessors.
Using Extension Methods with EnumerationsUsing Extension Methods with Enumerations
Extension methods were introduced in .NET 3.5 to allow classes to be apparently extended without modifying the class's code or using inheritance. Extension methods can also be used to add extra behaviour to enumerations.
C# Nested ClassesC# Nested Classes
When one class is entirely dependent upon another, you may decide to implement it using a nested class. Nested classes are declared within the scope of an existing class and receive special benefits when they access their parent class's members.
Setting Automatic Property Values in a Struct&#39;s ConstructorSetting Automatic Property Values in a Struct's Constructor
When initialising the properties of a structure using a custom constructor, you can write to the backing variables to set the property values indirectly. When using automatically implemented properties, these backing variables are unavailable.
C# NaN and IsNaNC# NaN and IsNaN
Some mathematical operations yield results that are not real numbers. The answers may be imaginary numbers or undefined values, either of which cannot be represented within a floating-point structure. In these cases, the resultant value will be NaN.
Representing Infinity in C#Representing Infinity in C#
When performing mathematical operations, it is possible to obtain a result that is either positive or negative infinity. C# and the .NET framework permit this result and allow storage of infinite values within selected floating-point structures.
C# Collection InitializersC# Collection Initializers
C# 3.0 introduces collection initializers, giving a new syntax that permits collections to be declared and populated in a single statement. They can be combined with object initializers to provide an elegant syntax for creating a collection of objects.
C# IteratorsC# Iterators
C# 2.0 introduced iterators. Iterators can be added to a class to allow traversing of a sequence of values with the foreach command. Although possible in earlier language versions, iterators remove the need to manually implement the IEnumerable interface.
C# Friend AssembliesC# Friend Assemblies
Occasionally you may want to access internal classes and their members found in one assembly from code in a separate assembly. The 'internal' modifier prevents this type of access. This restriction can be circumvented using C# 2.0 friend assemblies.
C# Static ClassesC# Static Classes
C# version 2.0 provides a new facility that permits the creation of static classes. These classes cannot be instantiated and so may only contain static members. These members can then be used without the requirement to create an object beforehand.
<< Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Next >> |