TAILIEUCHUNG - C# Bible 2002 phần 6

Tham khảo tài liệu 'c# bible 2002 phần 6', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | public static void Main This generates a compile-time warning. HelloWorld Mark HelloWord as Obsolete Obsolete Next version uses Hello Universe public static string HelloWorld return HelloWorld Figure 17-1 shows the task list for the compiler warnings that result from compiling the preceding code. Figure 17-1 Warning output from using the Obsolete attribute If you want to ensure that an error occurs and not just a warning message you can modify the marked code with the true value for the IsError property and the class will not compile. If you modify the Obsolete attribute in the previous code to the following an error occurs Obsolete Next version uses Hello Universe true As you can see using the Obsolete attribute enables you to preserve existing code while ensuring that developers are not using out-of-date types. Writing Your Own Attribute Classes The .NET Framework ships with a significant number of attribute classes that you can use for a variety of purposes. You might need an attribute however that covers functionality not included in the .NET Framework. For example you might like to have a code review attribute that labels a class with a date specifying the last time that code for a class was reviewed by your peers. In cases such as these you will need to define your own attributes and have them operate just like any of the attributes that ship with the .NET Framework. As it turns out the .NET Framework fully supports the construction of new attribute classes. In this section you see how new attribute classes are developed and used by .NET code. You can write your own attribute classes and use them in your code just as you would use an attribute from the .NET Framework. Custom attribute classes act like regular classes they have properties and methods that enable the user of the attribute to set and retrieve data. Attributes are implemented with attribute classes. Attribute classes derive from a class in the .NET System .

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.