O'Reilly logo

Microsoft® Visual C#® 2012 Step by Step by John Sharp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 17. Introducing Generics

After completing this chapter, you will be able to

  • Explain the purpose of generics.

  • Define a type-safe class by using generics.

  • Create instances of a generic class based on types specified as type parameters.

  • Implement a generic interface.

  • Define a generic method that implements an algorithm independent of the type of data on which it operates.

In Chapter 8, you learned how to use the object type to refer to an instance of any class. You can use the object type to store a value of any type, and you can define parameters by using the object type when you need to pass values of any type into a method. A method can also return values of any type by specifying object as the return type. Although this practice is very flexible, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required