Home
Articles
Tutorials
FAQ
Contact
Newsletter
Search
<< Previous |
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
Next >>
|
C# Variable Naming and the @ Symbol
C# allows very flexible naming of variables and other symbols. This includes the use of alphanumeric characters, a mixture of upper and lower case letters and the underscore symbol. It is even possible to use a variable name that is a reserved word.
Console Applications and %ERRORLEVEL%
When developing console applications that may be launched from batch files it can be helpful to return an integer to indicate the final status of the program. This value can be interrogated in the batch file using the %ERRORLEVEL% environment variable.
C# Optional Parameters in Library Code
C# optional parameters provide a handy way to create methods that can be called with a varying number of arguments but without the need to create overloaded versions. However, the way that they are used in referenced libraries can cause problems.
Looping Through an Entire Integer Range
As most for loops rely on a predicate that is based upon the loop control variable, iterating through an entire integer range is not as simple as it may first seem. An easy way to overcome the problems caused is to use a while loop instead.
C# Closures
Closures are usually associated with functional programming languages, where they link a function to its referencing environment, permitting access to variables outside of the function's scope. With the use of delegates, closures are available in C#.
Creating Type Aliases in C#
The using directive of the C# programming language is often used to create namespace aliases, allowing types with matching names that appear in separate namespaces to be easily accessed. A lesser known use of the directive is to create aliases for types.
C# Static Field Initialisation Order
Static fields can be used to hold information that is made available by, or used within, a class without requiring that an instance of that type is created. When initialising static fields, care must be taken that values are applied in the correct order.
C# Sizeof Keyword
In some situations it is necessary to know the size of a value type, such as a built-in numeric data type or a custom structure. The number in bytes can be looked up or calculated, or the sizeof keyword can be used to automatically obtain the size.
C# Volatile Fields
Optimisation techniques used when compiling or running software that uses the .NET framework can lead to unexpected results. One situation that causes problems is performing non-volatile reads of fields in multithreading or parallel programming scenarios.
C# Defining Preprocessor Symbols
In C#, preprocessor symbols can be defined or undefined in code or during compilation. With the use of the #if preprocessor directive, they determine which parts of the code are compiled and which are excluded from the final assemblies.
<< Previous |
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
Next >>
|
Did you arrive here via Google Reader? If so, please
click here
for important information.
.NET Framework
Algorithms and Data Structures
Audio
C# Programming
Configuration
Debugging
Design Patterns
Documentation
Graphics
Input / Output
LINQ
Network and Internet
Parallel and Asynchronous
Performance
Programming Concepts
Refactoring
Reference Sheets
Reflection
Security
SQL Server
System Information
Testing
Tools
Visual Studio
Windows Programming
Windows Presentation Foundation
XML
©2006-
2013
BlackWasp
All Rights Reserved
Cookie Policy
Privacy Policy
Terms of Use