TAILIEUCHUNG - Beginning Microsoft Visual C# 2008 PHẦN 9

Người sử dụng và thiết lập cấu hình ứng dụng có thể được lưu trữ được lấy ra trong thời gian tới ứng dụng của bạn là chạy. Giới hạn tập tin văn bản, chẳng hạn như các tập tin bằng dấu phẩy được sử dụng bởi nhiều hệ thống di sản, và tương thích với các hệ thống như vậy bạn | Part V Additional Techniques A similar method is used to set the Inherited property. If a custom attribute has properties then you can set these in the same manner. One example might be to add the name of the person who fixed the bug public readonly string BugNumber public readonly string Comments public readonly string Author public override string ToString if Author return BugFix 0 1 BugNumber Comments else return BugFix 0 by 1 2 BugNumber Author Comments This adds the Author field and an overridden ToString implementation that displays the full details if the Author field is set. If the Author property is not defined when you attribute your code then the output from the BugFix attribute just shows the bug number and comments. The ToString method would be used to display a list of bug fixes for a given section of code perhaps to print and file away somewhere. Once you have written the BugFix attribute you need some way to report the fixes made on a class and the members of that class. The way to report bug fixes for a class is to pass the class type again a to the following DisplayFixes function. This also uses reflection to find any bug fixes applied to the class and then iterates through all methods of that class looking for BugFix attributes public static void DisplayFixes t Get all bug fixes for the given type which is assumed to be a class. object fixes typeof BugFixAttribute false Displaying fixes for 0 t Display the big fix information. foreach BugFixAttribute bugFix in fixes 0 bugFix Now get all members . functions of the class. foreach Memberinfo member in And find any big fixes applied to these too. object memberFixes typeof BugFixAttribute false if 0 1044 Chapter 30 Attributes .

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.