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

Tài liệu Declaring and Using Delegates ppt

1 256 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Declaring and using delegates
Định dạng
Số trang 1
Dung lượng 21,09 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

A delegate looks and behaves much like an ordinary method when it is called.. However, when you call a delegate, the runtime actually executes the method the delegate refers to.. You can

Trang 1

Declaring and Using Delegates

A delegate is a pointer to a method A delegate looks and behaves much like an ordinary method when it is called However, when you call a delegate, the runtime actually

executes the method the delegate refers to You can dynamically change the method that

a delegate references, so code that calls a delegate might actually run a different method each time it executes The best way to understand delegates is to see them in action, so let's work through an example

NOTE

If you are familiar with C++, a delegate is very similar to a function pointer However, unlike function pointers, delegates are type-safe; you can only make a delegate refer to a method that matches the signature of the delegate, and you cannot call a delegate that does not refer to a valid method

Ngày đăng: 24/12/2013, 09:16

TỪ KHÓA LIÊN QUAN

w