2002 sams teach yourself c sharp in 24 hours

876 190 0
2002   sams   teach yourself c sharp in 24 hours

Đ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

Sams Teach Yourself C#™ in 24 Hours By James Foxall and Wendy Haro-Chun Table Contents About Authors of the Publisher: Sams Publishing Pub Date: March 13, 2002 ISBN: 0-672-32287-0, 528 pages Sams Teach Yourself C# in 24 Hours provides readers with 24 structured lessons that provide a light, but thorough introduction to C# James Foxall moves beyond the pure syntax covered in existing books, to guide readers step-bystep through a cohesive presentation of the basics of C# Once the basics are understood, Foxall shows the reader how to apply this knowledge to real-world Windows programming tasks using C# Each chapter contains exercises that reinforce the lessons learned in each chapter Tips, Notes, and Cautions provide additional advice from the authors on how to get up to speed and programming quickly with C# Sidebars provide the more experienced reader with tips that will ease their migration from Visual Basic 6 and Visual C++ to C# Sams Teach Yourself C#™ in 24 Hours Copyright About the Authors Acknowledgments Tell Us What You Think! Introduction Audience and Organization Conventions Used in This Book Onward and Upward! Part I The Visual Studio Environment Hour 1 A C# Programming Tour Starting C# Creating a New Project Understanding the C# Environment Changing the Characteristics of Objects Naming Objects Setting the Text Property of the Form Giving the Form an Icon Changing the Size of the Form Adding Controls to a Form Designing an Interface Adding an Invisible Control to a Form Coding an Interface Running a Project Summary Q&A Workshop Hour 2 Navigating C# Using the Visual Studio NET Start Page Navigating and Customizing the C# Environment Adding Controls to a Form Using the Toolbox Setting Object Properties Using the Properties Window Managing Projects Managing Project Files with the Solution Explorer Getting Help Summary Q&A Workshop Hour 3 Understanding Objects and Collections Understanding Objects Understanding Properties Understanding Methods Building an Object Example Project Understanding Collections Using the Object Browser Summary Q&A Workshop Hour 4 Understanding Events Understanding Event-Driven Programming Building an Event Example Project Summary Q&A Workshop Part II Building a User Interface Hour 5 Building Forms—Part I Changing the Name of a Form Changing the Appearance of a Form Showing and Hiding Forms Summary Q&A Workshop Hour 6 Building Forms—Part II Working with Controls Creating TopMost Windows Creating Transparent Forms Creating Scrollable Forms Creating MDI Forms Setting the Startup Object Summary Q&A Workshop Hour 7 Working with the Traditional Controls Displaying Static Text with the Label Control Allowing Users to Enter Text Using a Text Box Creating Buttons Creating Containers and Groups of Option Buttons Displaying a List with the List Box Creating Drop-Down Lists Using the Combo Box Summary Q&A Workshop Hour 8 Advanced Controls Creating Timers Creating Tabbed Dialog Boxes Storing Pictures in an Image List Building Enhanced Lists Using the List View Creating Hierarchical Lists with the Tree View Summary Q&A Workshop Hour 9 Adding Menus and Toolbars to Forms Building Menus Programming Menus Using the Toolbar Control Creating a Status Bar Summary Q&A Workshop Hour 10 Drawing and Printing Understanding the Graphics Object Working with Pens Using System Colors Working with Rectangles Drawing Shapes Drawing Text Persisting Graphics on a Form Build a Graphics Project Example Summary Q&A Workshop Part III Making Programming! Things Happen— Hour 11 Creating and Calling Methods Creating Class Members Writing Methods Creating the User Interface of Your Project Calling Methods Exiting Methods Working with Tasks Summary Q&A Workshop Hour 12 Using Constants, Data Types, Variables, and Arrays Understanding Data Types Defining and Using Constants Declaring and Referencing Variables Determining Scope Naming Conventions Summary Q&A Workshop Hour 13 Performing Arithmetic, Manipulation, and Date/Time Adjustments Performing Basic Arithmetic Comparing Equalities Understanding Boolean Logic Manipulating Strings Working with Dates and Times Summary Q&A Workshop String Hour 14 Making Decisions in C# Code Making Decisions Using if Statements Evaluating an Expression for Multiple Values Using switch Branching Within Code Using goto Summary Q&A Workshop Hour 15 Looping for Efficiency Looping a Specific Number of Times Using for Statements Using do…while to Loop an Indeterminate Number of Times Summary Q&A Workshop Hour 16 Debugging Your Code Adding Comments to Your Code Identifying the Two Basic Types of Errors Using C#'s Debugging Tools Writing an Error Handler Using try catch finally Summary Q&A Workshop Hour 17 Designing Objects Using Classes Understanding Classes Instantiating Objects from Classes Summary Q&A Workshop Hour 18 Interacting with Users Displaying Messages Using the MessageBox.Show() Method Creating Custom Dialog Boxes Interacting with the Keyboard Using the Common Mouse Events Summary Q&A Workshop Part IV Working with Data Hour 19 Performing File Operations Using the Open File Dialog and Save File Dialog Controls Manipulating Files with the File Object Manipulating Directories with the Directory Object Summary Q&A Workshop Hour 20 Controlling Other Applications Using Automation Creating a Reference to an Automation Library Creating an Instance of an Automation Server Manipulating the Server Summary Q&A Workshop Hour 21 Working with a Database Introduction to ADO.NET Connecting to a Database Manipulating Data Using the Data Form Wizard Summary Q&A Workshop Part V Deploying Solutions and Beyond Hour 22 Deploying a Solution Creating a Custom Setup Program Running a Custom Setup Program Uninstalling an Application You've Distributed Summary Q&A Workshop Hour 23 Introduction to Web Development XML SOAP ASP.NET Web Forms XML Web Services Summary Q&A Workshop Hour 24 The 10,000-Foot View The NET Framework Common Language Runtime (CLR) Microsoft Intermediate Language Namespaces Common Type System Garbage Collection Summary Q&A Workshop Appendix A Answers to Quizzes/Exercises Answers to Hour 1 Answers to Hour 2 Answers to Hour 3 Answers to Hour 4 Answers to Hour 5 Answers to Hour 6 Answers to Hour 7 Answers to Hour 8 Answers for Hour 9 Answers to Hour 10 Answers to Hour 11 Answers to Hour 12 Answers to Hour 13 Answers to Hour 14 Answers to Hour 15 Answers to Hour 16 Answers to Hour 17 Answers to Hour 18 Answers for Hour 19 Answers to Hour 20 Answers to Hour 21 Answers to Hour 22 Answers for Hour 23 Answers for Hour 24 Top 5: but not changed by client code? A5: 6: Create a property procedure that includes the get accessor, but not the set accessor What is the best way to store the internal value of a property within a class? A6: As a private class-level variable 7: Which is generally superior, early binding or late binding? A7: Early binding 8: A8: What is the best way to release an object you no longer need? Call the object's Dispose() method if it has one, and then set the object variable to null Top Answers to Hour 18 1: What minimal argument should you supply when calling MessageBox.Show()? A1: The prompt argument, the string for the message If you don't supply a value for the title parameter of 2: MessageBox.Show(), what gets displayed in the title bar of the message? A2: Nothing 3: What type of data is always returned by the MessageBox.Show() method? A3: A DialogResult 4: Which event fires first, the KeyUp or KeyPress event? A4: KeyPress 5: How do you determine which button is being pressed in a mouse-related event? A5: Use the Buttons property of the e object in the event handler Top Answers for Hour 19 1: A1: 2: True or False: The Open File dialog box automatically opens a file False The control returns the name of the file the user wants to open, but it doesn't open the file What symbol is used to separate a filter description from its extension? A2: The pipe (|) symbol 3: What objects are used to manipulate files? A3: System.IO.File and System.IO.FileInfo 4: What arguments are required by System.IO.File.Copy()? Two arguments are required The first is the name of the A4: current file; the second is the name of the file to create as a result of the copy 5: How would you rename a file? A5: Use System.IO.File.Move(), using the same path but a different filename 6: True or False: Files deleted with System.IO.File.Delete() are sent to the Recycle Bin A6: False 7: What objects are used to manipulate folders? System.IO.Directory and System.IO.DirectoryInfo A7: Sometimes Microsoft calls them folders, sometimes directories In NET, however, it's usually directory Top Answers to Hour 20 1: Before you can early bind objects in an automation server, you must do what? A1: Create a reference to a type library 2: What is the most likely cause of not seeing a type library listed in the Add References dialog box? A2: You don't have the component installed on your computer 3: For C# to use a COM library, it must create a: A3: Wrapper 4: To manipulate a server via automation, you manipulate: A4: 5: An object variable referencing an object in the server's object model To learn about the object library of a component, you should: A5: Read the documentation or use the Object Browser Top Answers to Hour 21 1: What is the name of the data access components used in the NET Framework? A1: ADO.NET 2: What is the name given to a collection of DataRows? A2: DataTable 3: How do I get data into and out of a DataTable? A3: Use the Fill() and Update() methods of the ADO.NET DataAdapter 4: What object is used to connect to a data source? The connection object appropriate to the data source A4: (SqlConnection or OleDbConnection) 5: What argument of a connection string contains information about the type of data being connected to? A5: The Provider= argument 6: A6: 7: The functionality of a DataTable (read-only, updateable, and so forth) is determined by what? The DataTable always has the same functionality, regardless of the source of the data What are the two NET data providers supplied as part of the NET Framework? A7: The OleDb NET Data Provider and the SqlClient NET Data Provider 8: What method of a DataTable object do you call to create a new row? A8: NewRow() Top Answers to Hour 22 1: To create a custom setup program, you start by creating what type of Visual Studio project? A1: The project type is Setup Project, which can be found in the Setup and Deployment Projects folder 2: The final build file of a project (EXE, DLL, and so on) is referred to as the what? A2: Output of the project True or False: To include the output of a project, the 3: project must be added to the solution containing the setup program A3: True 4: Which build option creates smaller and faster builds? A4: Release builds are smaller and faster than Debug builds 5: How do you add a file to an installation? A5: Open the Project menu, open the Add submenu, and choose File 6: A6: If the Project menu doesn't have the menu options for creating a setup program, what might be wrong? You probably have a project other than the Setup Project selected in the Solution Explorer 7: How do you add folders to the custom setup program? A7: Right-click the File System on the Target Machine item in the left pane of the Setup Project 8: How do you create a shortcut for a file in a setup program? A8: Right-click the file and choose the appropriate menu item Top Answers for Hour 23 1: What does XML stand for? A1: eXtensible Markup Language 2: An element is designated in an XML document using the what? A2: Starting and ending tags 3: True or False: XML tag names are case sensitive A3: True 4: What is the name of the protocol used by NET to marshal object requests across the Web? A4: SOAP (Simple Object Access Protocol) 5: What forms engine is used to create forms that run over the Internet? A5: Web Forms Which forms engine provides for faster response to user 6: interaction? A6: Windows Forms 7: Where is the NET Framework installed for Windows Forms applications? Web Forms applications? The NET Framework is installed on the user's computer for A7: Windows applications and on the Web server for Web Forms applications 8: What is the name of the ASP.NET technology used to expose application logic as objects over the Web? A8: XML Web services Top Answers for Hour 24 1: The classes and technology that make up NET's underlying infrastructure are called what? A1: The NET Framework 2: What is the name of the shared NET runtime? A2: The Common Language Runtime (CLR) 3: True or False: Each NET language uses its own code editor and debugging tools False All NET languages share the same IDE and the A3: same debugging tools These are just a few of the benefits of the Common Language Runtime 4: A4: 5: True or False: Code that runs within the Common Language Runtime is called unmanaged code False It is called managed code because it is managed by the runtime Code written in a NET language such as C# is compiled to what? A5: Intermediate Language code (IL) 6: What are namespaces? A6: Namespaces are the "nodes" in the hierarchical structure of classes in the NET environment One of the things that gives NET its multilanguage capabilities is that all data is declared and managed in the 7: same way across all languages This is handled by NET's what? A7: Common Type System 8: What destroys objects, freeing all the resources that they consume? A8: NET's garbage collector Top ... III Making Programming! Things Happen— Hour 11 Creating and Calling Methods Creating Class Members Writing Methods Creating the User Interface of Your Project Calling Methods Exiting Methods... Setting the Text Property of the Form Giving the Form an Icon Changing the Size of the Form Adding Controls to a Form Designing an Interface Adding an Invisible Control to a Form Coding an Interface Running a Project Summary... The Visual Studio Environment Hour 1 A C# Programming Tour Starting C# Creating a New Project Understanding the C# Environment Changing the Characteristics of Objects Naming Objects Setting the Text Property of the Form

Ngày đăng: 25/03/2019, 16:34

Từ khóa liên quan

Mục lục

  • Teach Yourself C# in 24 Hours

  • Table of Contents

  • Book Cover

  • Copyright

  • About the Authors

  • Acknowledgments

  • Tell Us What You Think!

  • Introduction

    • Audience and Organization

    • Conventions Used in This Book

    • Onward and Upward!

    • Part I: The Visual Studio Environment

      • Hour 1. A C# Programming Tour

        • Starting C#

        • Creating a New Project

        • Understanding the C# Environment

        • Changing the Characteristics of Objects

        • Naming Objects

        • Setting the Text Property of the Form

        • Giving the Form an Icon

        • Changing the Size of the Form

        • Adding Controls to a Form

        • Designing an Interface

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan