Home >
Main >
C# : .NET's Native Tongue
C# : .NET's Native Tongue
2008 October 03 | 01:13 pm
Introduction
Programmers familiar with C/C++ or Java may feel a sense of dejá vü when first coming into contact with the C# (pronounced C Sharp
) language, which, considering C# has its roots in the C++ language, should not be surprising. C# is developed by Microsoft to implement its .NET framework.
Advantages?
C# is a highly-managed language. What this means that the compiler
will not allow unsafe operations, unless explicitly forced to do so. This is intended to prevent the unintentional errors in logic and syntax other languages allow inexperienced programmers to code.
One of the unsafe operations
C# forbids is implicit conversion between incompatible data types. For instance, you cannot implicitly convert a Double object into a Single or Integer object. Why? Because your data becomes truncated. Single and Integer types are narrower
, meaning they have a smaller memory value, than Double types. This could theoretically cause improper execution of code that tests the equivalency of two or more objects.
Cool! Hey, why did you quote compiler
? Something I should know?
That's for one simple reason. C#, like most modern OOP languages, does not actually compile. Rather, it is interpreted
into MSLI byte-code when you ask your development environment to build the project code. Then, at runtime, a JIT (Just-In-Time) compiler completes the compilation into machine code. The advantage of using a JIT compiler versus a true
compiler is that the executable can be easily ported from system to system, as long as the proper runtime environment is present. For Microsoft languages, the necessary runtime is the .NET Framework.
Drawbacks?
While this does make our code more portable (anything that can run a newer version of Windows can probably run our code), it also means our application takes longer to execute. Of course, the average user will never notice, as this only becomes an issue with systems that require high-speed processing, such as precision mold software or industrial color spectrum analyzers...
C# Keywords
There are certain words that have special meaning the C# compiler and cannot be used in your code for anything else unless you precede them with the @ sign.
The following list is every keyword as of .NET Framework 3.5.
| abstract | event | new | struct |
| as | explicit | null | switch |
| base | extern | object | this |
| bool | false | operator | throw |
| break | finally | out | true |
| byte | fixed | override | try |
| case | float | params | typeof |
| catch | for | private | uint |
| char | foreach | protected | ulong |
| checked | goto | public | unchecked |
| class | if | readonly | unsafe |
| const | implicit | ref | ushort |
| continue | in | return | using |
| decimal | int | sbyte | virtual |
| default | interface | sealed | volatile |
| delegate | internal | short | void |
| do | is | sizeof | while |
| double | lock | stackalloc | else |
| long | static | enum | namespace |
| string |
Source: MSDN Visual C# Developer Center
Updated:
2008 October 17 | 10:56 am
Tags:
C#, .NET, Keywords
Back to top •
Comments ( 0 ) •
Login to comment.
Home
About
Blog
Credits
RSS
Sorry. There are currently no comments for this article.