BlackWaspTM

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# Partial TypesC# Partial Types
C# version 2.0 introduced partial types. This new concept permits the code in a single class, structure or interface to be split into more than one code file. Each constituent part of the type is combined during the compilation process.
C# Extension MethodsC# Extension Methods
Sometimes is is necessary to add functionality to a library for which you do not own the source code and where using inheritance to subclass functionality is not viable. This problem can be overcome with the careful use of C# 3.0 extension methods.
C# Object InitializersC# Object Initializers
C# 3.0 introduces a new feature that configures the properties of newly instantiated objects. Object initializers allow multiple property values to be set within a single assignment operation. They are used in conjunction with any provided constructors.
C# Implicitly Typed ArraysC# Implicitly Typed Arrays
With C# 3.0, Microsoft introduced the concept of implicitly typed arrays to the language. With such an array, the type is not specified explicitly in the code. Instead, the compiler decides upon the type to use based upon the array's initial values.
C# Read-Only FieldsC# Read-Only Fields
The readonly keyword permits class and structure fields to be configured so that their values cannot be modified after they have been initialised. This seems similar to the functionality provided by constants. However, there are several key differences.
Check if an Enumeration Value is DefinedCheck if an Enumeration Value is Defined
Variables that are declared as enumerated types can contain values that are not defined within the related enumeration. Sometimes it is necessary to check whether a numeric value or a name exists within the list of constants. This tip explains how.
C# Decreased Property Accessor VisibilityC# Decreased Property Accessor Visibility
In early versions of C#, properties could be declared with different scopes, such as public, private or internal. However, it was not possible to have different scopes for the get and set accessors. C# and the .NET framework 2.0 remove this limitation.
C# Using StatementC# Using Statement
If an object is of a class that implements the IDisposable interface, you should dispose of the object as early as possible. You can dispose of an object manually with the Dispose method. The using statement provides a more elegant approach.
Boxing and UnboxingBoxing and Unboxing
When you wish to use a value type with a collection or another place where an object is expected, the value type is boxed within the resultant object. To retrieve the value and convert it back into a simple value type, it is unboxed.
Overriding the ToString MethodOverriding the ToString Method
Every class and object includes the ToString method. By default, this returns a string containing the name of your customer class or structure. By overriding this method, you can return more meaningful, human-readable information about your objects.
<< Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Next >> |