- Microsoft developed C#, a new programming language based on the C and C++ languages.
- Microsoft describes C# in this way: ”C# is a simple, modern, object–oriented, and typesafe programming language derived from C and C++.
- C# (pronounced c sharp) is firmly planted in the C and C++ family tree of languages and will immediately be familiar to C and C++ programmers.
- C# aims to combine the high productivity of visual basic and raw power of C++.”
- C# is a case sensitive language.
Some aspects of C# will be familiar to those, who have programmed in C, C++, or Java. C# incorporates the Smalltalk concept, which means everything is an object. In other words, all types in C# are objects. C# properties are similar to Visual Basic language properties. The Rapid Application Development (RAD) goal in C# is assisted by C#’s use of concepts and keyword, such as class, structure, statement, operator, and enumeration. The language also utilizes the concepts contained in the Component Object Model (COM) architecture.
C# Language Features:
C# Language Features:
C# was developed as a language that would combine the best features of previously existing Web and Windows programming languages. Many of the features in C# language are preexisted in various languages such as C++, Java, Pascal, and Visual Basic. Here is a list of some of the primary characteristics of C# language.
- Modern and Object Oriented
- Simple and Flexible
- Automatic Memory Management
- Versioning Control
- Cross Platform Interoperability
Table 3.1. The intrinsic types built into C#
Size (in bytes)
Unsigned (values between 0 and 255).
Unicode characters (a modern way of storing most characters, including international language characters).
True or false.
Signed (values between -128 and 127).
Signed (short) (values between -32,768 and 32,767).
Unsigned (short) (values between 0 and 65,535).
Signed integer values between -2,147,483,648 and 2,147,483,647.
Unsigned integer values between 0 and 4,294,967,295.
Floating-point number. Holds the values from approximately +/-1.5 x 10-45 to approximately +/-3.4 x 1038 with seven significant figures.
Double-precision floating-point. Holds the values from approximately +/-5.0 x 10-324 to approximately +/-1.8 x 10308 with 15 to 16 significant figures.
Fixed-precision up to 28 digits and the position of the decimal point. This type is typically used in financial calculations. Requires the suffix "m" or "M" when you declare a constant.
Signed integers ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
Unsigned integers ranging from 0 to approximately 1.85 x 1019.
Each type has a name (such as int) and a size (such as 4 bytes). The size tells you how many bytes each object of this type occupies in memory. Programmers generally don't like to waste memory if they can avoid it, but with the cost of memory these days, you don't need to be particular about the memory cost of types. Most of the time, if you're using whole numbers you'll use an int, even if a short would be fine. Likewise, double is the commonly used type for decimal numbers, even though float is just fine in most cases. The Description column in Table 3.1, "The intrinsic types built into C#" lists the minimum and maximum values you can hold in objects of each type.