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.

Do follow common pointer-related conventions when designing members with pointers.

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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft