Murach's C# - How to work with interfaces, structures, and class
libraries
Although a C# class can inherit only one class, it can also implement one or more
interfaces. So in this chapter, you'll learn how to create and implement a C# interface,
and you'll specifically learn how to implement the ICloneable, IEnumerable, and IEnumerator
interfaces. After that, you'll learn how to create and use structures, which are similar
to classes but define value types rather than reference types. And you'll learn how
to make your classes easier to use by storing them in class libraries.
|
|
|
|
An introduction to interfaces |
440 |
|
Some of the interfaces defined by the
.NET Framework |
442 |
|
How to create an interface |
444 |
|
How to implement an interface |
446 |
|
A Product class that implements the
ICloneable interface |
448 |
|
How to use an interface as a parameter |
450 |
|
|
The IEnumerable interface |
452 |
|
The IEnumerator interface |
452 |
|
The code for the ProductList class |
454 |
|
The code for the ProductEnumerator class |
454 |
|
Code that uses the ProductList enumerator |
456 |
|
|
How to create a structure |
458 |
|
How to use a structure |
458 |
|
|
How class libraries work |
460 |
|
How to create a class library project |
462 |
|
How to add a reference to a class library |
464 |
|
How to use the classes in a class library |
464 |
|
 |
|
|
|
|
© Copyright 1998-2008 Mike Murach &
Associates, Inc. All rights reserved.
|