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 >> |
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 custom class or structure. By overriding this method, you can return more meaningful, human-readable information about your objects.
C# #line DirectiveC# #line Directive
When you compile and execute C# code, errors and warnings may be generated with a reference to a source code file and line number. If you develop a tool that creates the code to be compiled, you may want to change the reported error locations.
Check Type Compatibility with the &quot;Is&quot; OperatorCheck Type Compatibility with the "Is" Operator
Polymorphism allows a single variable to contain objects of different types. Sometimes it is necessary to determine whether a variable contains an object that is compatible with a specific type. This can be achieved using the "is" operator.
C# #warning and #error DirectivesC# #warning and #error Directives
In some situations you may wish to purposefully cause compilation errors or warnings in your code. For example, a warning indicating that you are compiling in debug mode or an error for deprecated code. These can be added using preprocessor directives.
C# Type Conversion with the &quot;As&quot; OperatorC# Type Conversion with the "As" Operator
Objects can be converted from one type to another, assuming that the types are compatible. Often this is achieved using implicit conversion or explicitly with the cast operator. An alternative to this is the use of the "as" operator.
C# Namespace Alias QualifierC# Namespace Alias Qualifier
Namespaces are ideal for organising your classes and structures. As software increases in size, the probability of namespace and class names colliding and causing ambiguity problems increases. The namespace alias qualifier decreases this possibility.
C# Anonymous MethodsC# Anonymous Methods
C# allows the declaration of delegates. These hold method references that may be changed at run-time and are essential for creating events. It is often the case that the delegate is never changed. In these cases, anonymous methods can simplify code.
C# Anonymous TypesC# Anonymous Types
A new feature of C# 3.0 is the ability to create anonymous types. These interesting classes are defined for temporary use within class members. They allow the convenient encapsulation of read-only properties without the need to code a complete class.
C# Implicitly Typed VariablesC# Implicitly Typed Variables
C# 3.0 introduced the concept of implicitly typed local variables. These are compiled in exactly the same manner as their explicitly typed counterparts, except that the compiler automatically determines the variable type according to its usage.
<< Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Next >> |