ElementSizeConst
The ElementSizeConst property specifies the size of an element in bytes. This property is allowed on Pre and Post attributes and can only be applied to pointer or array data types. The ElementSizeConst property must be used in conjunction with any one of the following properties:
ValidElements
ValidElementsLength
ValidElementsConst
WritableElements
WritableElementsConst
WritableElementsLength
The value of ElementSizeConst property is a constant of type size_t. To specify an element size that depends on the value of another parameter to the function, use ElementSize property.
Example
The following code shows that the size of each element is 4 bytes, and the number of valid elements is three:
// C
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(Deref=0, Null=SA_No, ElementSizeConst=4, ValidElementsConst=3)] char pc[]);
// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(Deref=0, Null=No, ElementSizeConst=4, ValidElementsConst=3)] char pc[]);
C6513 is issued if the ElementSizeConst property is used alone.