8

Usage Guidelines

This chapter contains guidelines for using common types in publicly accessible APIs. It deals with direct usage of built-in framework types (e.g., Collection<T>, serialization attributes), implementing common interfaces, and inheriting from common base classes. The last section of the chapter discusses overloading common operators.

8.1 Arrays

This section presents guidelines for using arrays in publicly accessible APIs.

Images DO prefer using collections over arrays in public APIs. Section 8.3.3 provides details about how to choose between collections and arrays.

Click here to view code image

public class Order { public Collection<OrderItem> ...

Get Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.