1. Trang chủ
  2. » Công Nghệ Thông Tin

C# Bible 2002 phần 1 pdf

40 338 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 40
Dung lượng 467,85 KB

Nội dung

[...]... 2 -1, it's time to make it run Type the code from Listing 2 -1 into your favorite text editor and save it as a file called Listing2 -1. cs The cs extension is the extension for all files that contain C# code Note Before compiling the C# example, you must ensure that the C# compiler is within your Path The csc.exe application is typically in the c:\windows\ Microsoft.NET\ Framework\v1.0.xxxx (replace V1.0.Xxxx... 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... 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 it increases your productivity The NET Framework is made up of four parts, as shown in Figure 1- 1: the Common... 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... code shown in Listing 2 -1 is a complete C# application It runs from within a console window and prints the message Hello World! to the screen The sections that follow walk through this code one line at a time Listing 2 -1: Writing to the Console class HelloWorld { public static void Main() { System.Console.WriteLine("Hello World!"); } } Building a class The first line in our C# program defines a class... 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... invokes the NET Framework's C# compiler Running this command produces an executable called HelloWorld.exe, which you can run just as you would any Windows application Running this executable writes text to the console window as shown in Figure 2 -1 Figure 2 -1: The command-prompt window shows the Hello World application in action Congratulations! You have just written your first C# application Understanding... application Understanding keywords and identifiers The C# application in Listing 2 -1 contains many words, separated by spaces It uses two types of names: keywords and identifiers This section describes the differences between these two types of names Keywords are words that have special meaning in the C# language These words have been set aside in C# and are referred to as reserved words The words class,... application shown in Listing 2 -1 defines a class with a function called Main() The Main() function is an important part of C# applications, as the Main() function is where execution of your program begins Every C# application that you write must have one class with a function called Main() The Main() function is referred to as your application's entry point, and the execution of your C# applications begin with . of the pieces fit 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++ in mind, and the syntax. go to Nitin for, well, everything. Part I: C# Language Fundamentals Chapter List Chapter 1: An Introduction to C# Chapter 2: Writing Your First C# Program Chapter 3: Working with Variables. mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 10 7 or 10 8 of the 19 76 United States Copyright Act, without either the prior written permission of the Publisher,

Ngày đăng: 05/08/2014, 10:20

TỪ KHÓA LIÊN QUAN