Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 591 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
591
Dung lượng
4,06 MB
Nội dung
[...]... C to C++ to C#, you examined the high points of the C# feature list You also investigated the output of the C# compiler, MSIL code, and metadata, and reviewed the use of assemblies as the building blocks of compiled NET code Chapter 2: Writing Your First C# Program In This Chapter This chapter walks you through the development of a simple C# application You also learn about how simple C# applications... of the original quirks and deficiencies found in C C# is starting with a clean slate and without any compatibility requirements, so it can retain the strengths of its predecessors and discard the weaknesses that made life hard for C and C++ programmers Introducing C# C#, the new language introduced in the NET Framework, is derived from C++ However, C# is a modern, objected-oriented (from the ground... attributes within the NET Framework Compiling C# Running your C# code through the C# compiler produces two important pieces of information: code and metadata The following sections describe these two items and then finish up by examining the binary building block of NET code: the assembly Microsoft Intermediate Language (MSIL) The code that is output by the C# compiler is written in a language called... low level nature of C Microsoft designed C# to retain much of the syntax of C and C++ Developers who are familiar with those languages can pick up C# code and begin coding relatively quickly The big advantage to C#, however, is that its designers chose not to make it backwardly compatible with C and C++ While this may seem like a bad deal, it's actually good news C# eliminates the things that makes C... well as explores the support for emerging Web technologies It then briefly discusses many of the features found in the C# language and how it compares to other popular languages The NET Framework Microsoft designed C# from the ground up to take advantage of its new NET Framework Because C# is a player in this new NET world, you should have a good understanding of what the NET Framework provides and how... FullName() { return FirstName + LastName; } } Note Single inheritance means that a C# class can inherit from only one base class C# enables you to group your classes into a collection of classes called a namespace Namespaces have names, and can help organize collections of classes into logical groupings As you begin to learn C#, it becomes apparent that all namespaces relevant to the NET Framework begin... the first time that it is requested, which greatly increases the speed A History of C, C++, and C# The C# programming language was created in the spirit of the C and C++ programming languages This accounts for its powerful features and easy learning curve The same can't be said for C and C++, but because C# was created from the ground up, Microsoft took the liberty of removing some of the more burdensome... your compiled code to be easily moved to different hardware Suppose you've written some C# code and you'd like it to run on both your desktop and a handheld device It's very likely that those two devices have different types of CPUs If you only had a C# compiler that targeted a specific CPU, then you'd need two C# compilers: one that targeted your desktop CPU and another that targeted your handheld... while also providing an easy-to-learn language for inexperienced programmers are only two of the benefits to the new language on the block, C# Microsoft introduced C# to the public at the Professional Developer's Conference in Orlando, Florida, in the summer of 2000 C# combines the best ideas from languages such as C, C++, and Java with the productivity enhancements found in the Microsoft NET Framework... which you can read as follows: "C# compiler, I want to call the WriteLine() with a string parameter of 'Hello World!' The WriteLine() function can be found in a class called Console, and the Console class can be found in a namespace called System." Line 5 ends with a semicolon All C# statements must end with a semicolon The semicolon separates one statement from another in C# Compiling and Running the . together to construct a complete C# application.
Readers approaching C# with a background in C++ will find C# very familiar. C# was built
with C and C++. development using C# as the implementation
language and the .NET Framework's C# command-line compiler as the primary development
tool. C# development