tailieunhanh - Visual studio 2010 part 7

Biểu thức mã hóa và báo cáo Hiện có nhiều loại báo cáo bạn có thể viết với cả C # và VB, bao gồm cả chuyển nhượng, viện dẫn phương thức, phân nhánh, và vòng. Chúng tôi sẽ bắt đầu bằng cách nhìn vào các loại nguyên thủy, như số nguyên và chuỗi, và sau đó tôi sẽ chỉ cho cách xây dựng các biểu thức và thiết lập giá trị của các bài tập thực hiện. | Chapter 2 Learning Just Enough C or Basic Syntax 49 Coding Expressions and Statements There are various types of statements you can write with both C and VB including assignment method invocations branching and loops. We ll start off by looking at primitive types such as integers and strings and then I ll show how to build expressions and set values by performing assignments. Then you ll learn about branching statements such as if and switch in C or the case statement in VB. Finally you ll learn about various loops such as for and while. I describe these language features in general terms because they differ between C and VB but you ll learn that the concepts are essentially the same. Before writing any code you should know how Intellisense works it is an important productivity tool that reduces keystrokes for common coding scenarios. Making Intellisense Work for You Previously you saw how snippets work. Snippets use Intellisense to show a completion list. Intellisense is integrated into the VS editor allowing you to complete statements with a minimum number of keystrokes. The following walkthrough shows you how to use Intellisense as we add the following line to the Main method. Don t type anything yet just follow along to see how Intellisense works C Hello from Visual Studio 2010 VB Hello from Visual Studio 2010 The following steps show you how VS helps you save keystrokes 1. Inside the braces of the Main method type c and notice how the Intellisense window appears with a list of all available identifiers that start with c. This list is called a completion list. 2. Type o and notice that the completion list filters all but those identifiers that begin with co. 3. Type n and you ll see that the only identifier available is Console. This is what we want and you only needed to type three characters to get there. 4. At this point most people press the enter or tab key to let VS finish typing Console but that is effectively a