TAILIEUCHUNG - Defining've Pairs Classing

Defining Operator Pairs Some operators naturally come in pairs. For example, if you can compare two Hour values by using the != operator, you would expect to be able to also compare two Hour values by using the == operator. | Defining Operator Pairs Some operators naturally come in pairs. For example if you can compare two Hour values by using the operator you would expect to be able to also compare two Hour values by using the operator. The C compiler enforces this very reasonable expectation by insisting that if you define either operator or operator you must define them both. This neither-or-both rule also applies to the and operators and the and operators. The C compiler does not write any of these operator partners for you. You must write them all explicitly yourself regardless of how obvious they might seem. Here are the and operators for the Hour struct struct Hour public Hour int initialValue initialValue . public static bool operator Hour lhs Hour rhs return public static bool operator Hour lhs Hour rhs return . private int value The return type from these operators does not actually have to be Boolean. However you would have to have a very good reason for using some other type or these operators could become very confusing NOTE If you define operator and operator you should also override the Equals and GetHashCode methods inherited from . The Equals method should exhibit exactly the same behavior as operator define one in terms of the other . The GetHashCode method is used by other classes in the .NET Framework. When you use an object as a key in a hash table for example the GetHashCode method is called on the object to help calculate a hash value. For more information see the .NET Framework Reference documentation supplied with Visual Studio 2005 . All this method needs to do is return a distinguishing integer value don t return the same integer from the GetHashCode method of all your objects though as this will reduce the effectiveness of the hashing algorithms . Editing Data You have seen how to use a GridView control to fetch and browse data. The following set of exercises concentrate on deleting and modifying

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.