Structures and Common Language Specification

The Common Language Specification has established specific rules for structures. If you want your structure to be CLS-compliant, you need to overload the equality and inequality operators and redefine the behavior of the Equals and GetHashCode methods inherited from Object. Listing 11.1 shows an example of a CLS-Compliant structure.

Listing 11.1 Building a CLS-Compliant Structure

image

If you are not already familiar with overriding, you can read the next chapter and then take a look back at the preceding code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.95.107