Download presentation
Presentation is loading. Please wait.
Published byQuentin Simpson Modified over 6 years ago
1
C# Programming: From Problem Analysis to Program Design
Code Editor Tools C# Programming: From Problem Analysis to Program Design 4th Edition C# Programming: From Problem Analysis to Program Design
2
Code Snippets Templates you use to insert code
Speed up entry of common code constructs Named with a short alias Activate by either typing the alias, pressing the Tab key twice, or using IntelliSense menu to insert the code snippet Pressing Ctrl+K+X activates the code snippet list C# Programming: From Problem Analysis to Program Design
3
Code Snippets (continued)
Figure B-1 Code snippet list C# Programming: From Problem Analysis to Program Design
4
Code Snippets (continued)
Alias for the decrementing for is forr Figure B-2 Decrementing for statement code snippet C# Programming: From Problem Analysis to Program Design
5
Code Snippets (continued)
Pressing Tab twice after selecting the forr alias inserts the decremeting code snippet text Type new value for the field or press the Tab key to cycle through the editable fields Figure B-3 Code snippet inserted into text C# Programming: From Problem Analysis to Program Design
6
Code Snippets (continued)
Code snippets are XML files Can create your own code snippets File needs to end with .snippet filename extension C# Programming: From Problem Analysis to Program Design
7
Refactoring Modify the internal structure without changing the logic or the external behavior of the program Use Extract Method option to create a new method from a segment of code Code is automatically pulled out Method Heading is created…curly braces added Method call is automatically created Refactor is available from EDIT menu C# Programming: From Problem Analysis to Program Design
8
Refactoring (continued)
Figure B-5 New method name for the extracted code C# Programming: From Problem Analysis to Program Design
9
Refactoring (continued)
Figure B-6 CalculateAverage( ) method refactored C# Programming: From Problem Analysis to Program Design
10
Rename Change the name of identifiers for data types, local variables, namespaces, methods, and properties Can also change name in comments and strings Position the cursor on the identifier you want to rename and select Rename from the EDIT, Refactor menu Additional menu option of Rename overloads is available C# Programming: From Problem Analysis to Program Design
11
Rename (continued) Figure B-8 Previewing rename changes
C# Programming: From Problem Analysis to Program Design
12
Other Refactoring Options
Refactor, Encapsulate Field option lets you create a property from a local variable and then update your code with references to the new property Extract Interface Remove Parameters Reorder Parameters C# Programming: From Problem Analysis to Program Design
13
Working with Class Diagrams
Right-clicking on the project in Solution Explorer window reveals the View Class Diagram option Figure B-9 PresentationGUI class diagram C# Programming: From Problem Analysis to Program Design
14
Class Details View Shown under the Class Diagram in the Class Details pane Can go directly to code by right-clicking on the diagram and selecting View Code Figure B-10 Class Details view C# Programming: From Problem Analysis to Program Design
15
Using the Class Diagram to Add Members
Right-clicking on classes in class diagram reveals options to add additional methods, properties, fields, or events Also automatically generates underlying code Can add constructors C# Programming: From Problem Analysis to Program Design
16
Using the Class Diagram to Add Members (continued)
Figure B-11 Adding members using the class diagram C# Programming: From Problem Analysis to Program Design
17
Using the Class Diagram to Add Members (continued)
Figure B-12 Show base class for Person (Object) C# Programming: From Problem Analysis to Program Design
18
Other Code Editor Tips Zoom Box Selector
Press Ctrl+Mouse wheel to increase and decrease the font size Box Selector Select rectangular region, type a line, and have that line repeated for every line part of the region Hold Alt while using mouse to make vertical section Start typing…typed line appears on every line in region C# Programming: From Problem Analysis to Program Design
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.