Share via


Pointer Parameters 

Pointers are an advanced programming feature that should only be used in performance critical situations. Pointers allow access to locations in memory. The following guidelines help ensure that your library design makes effective use of pointers.

Do provide an alternative for any member that takes a pointer argument, as pointers are not CLS-compliant.

Avoid doing expensive argument checking of pointer arguments.

In general, you should check arguments; however, for performance-sensitive members, the overhead is often not worth it.

For example, members do not need to take a start index as a parameter because simple pointer arithmetic can be used to supply the pointer address as the pointer's base address added to the desired start index.

Portions Copyright 2005 Microsoft Corporation. All rights reserved.

Portions Copyright Addison-Wesley Corporation. All rights reserved.

For more information on design guidelines, see the "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries" book by Krzysztof Cwalina and Brad Abrams, published by Addison-Wesley, 2005.

See Also

Concepts

Parameter Design

Other Resources

Member Design Guidelines
Design Guidelines for Developing Class Libraries