TAILIEUCHUNG - Visual studio 2010 part 11

Trong chương trước, bạn đã học được cú pháp cơ bản và làm thế nào để tạo ra các loại của riêng bạn. Điều này chương trong vòng yếu tố cần thiết để trần của những gì bạn cần biết các đại biểu và các sự kiện, giao diện, và giới thiệu một cách nhanh chóng đến các mảng và generics | This page intentionally left blank Chapter 4 Learning Just Enough C and Intermediate Syntax 89 90 Microsoft Visual Studio 2010 A Beginner s Guide Key Skills Concepts Use Delegates and Events Implement Interfaces Code with Arrays and Generics In previous chapters you learned basic syntax and how to create your own types. This chapter rounds out the bare essentials of what you need to know with delegates and events interfaces and a quick introduction to arrays and generics. This material doesn t attempt to be too advanced but gives you enough information to understand the language concepts involved. You ll see all of these language features being used throughout the book and it s good to have some background on what they mean. Let s start off with delegates and events. Understanding Delegates and Events Sometimes you need to write flexible code that performs general operations. For example when the designers of the .NET Framework created user interfaces they added reusable controls such as buttons list boxes and grids. When writing these controls the framework designers didn t know how we would use them. For example how would anyone know what we wanted our code to do when a user clicks a button on the user interface So these controls have interaction points built in so that they can communicate with your program these interaction points are called events. These events fire whenever a user performs an action such as a button click or a list box selection. We write code to hook up these events to some other code in our program that we want to run when that event happens such as when the user clicks a button and this is what delegates are used for. An event defines the type of notifications that a object can provide and a delegate allows us to connect the event to the code we want to run. This section will show you the mechanics of how delegates and events work but you should understand that the mechanics may seem somewhat abstract at first. Delegates and events

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.