Explicit Type Conversion in C#
C# is a strongly typed language, which means that all variables have a type that must be declared, and that
the compiler verifies the type-consistency of expressions. Expressions, of course, are always of a type built-in
to the C# language, or are user-defined types.
For programmers coming to C# from a weakly typed language such as Visual Basic 6, strong typing and the programmatic
type conversions that it mandates are one of the most difficult things about working in C#. But cheer up:
working with type conversion is not brain surgery! After reading the two parts of this article, you should
be able to zip through most issues involving C# type conversion.
The first part of this article explained strong typing and its rationale, showed how VB.NET differs from C#.NET,
described the various possible type conversion techniques, and explained implicit casting. In this second part of
the article, I’ll explain how explicit conversion (also called casting) works. I’ll also discuss some related concepts and techniques:
|
|
Search Engine Optimization
 
Syndication Viewer
Our Web host:
IX WebHosting
|