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 >> |
Rounding Decimal Values in C#Rounding Decimal Values in C#
The decimal data type is used to store numbers with a high level of precision. The potentially large number of decimal places held is useful for many mathematical or statistical calculations. However, it is helpful to round values for display purposes.
C# Partial MethodsC# Partial Methods
C# 2.0 introduced partial types to allow class definitions to be split between several files. C# 3.0 extends the concept with partial methods, allowing method signatures to be declared but not implemented. This is ideal for use with code generation tools.
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 it 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.
<< Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Next >> |