Udostępnij za pośrednictwem


Access

The Access property specifies whether a value can be read from, written to, both, or neither. This property is allowed on Pre and Post attributes and can be applied to any data type.

The Access property must be set using one of the following values:

  • SA_NoAccess - the value may not be read from or written to.

  • SA_Read - the value may be read from, but not written to.

  • SA_Write - the value may be written to, but not read from.

  • SA_ReadWrite - the value may be read from and written to.

Note   By default, the Access property value is SA_ReadWrite. In addition, Access property value is inferred from the const qualifier as SA_Read.

Example

The following code shows how to use the Access property:

// C 
#include <CodeAnalysis\SourceAnnotations.h>
void f ([SA_Pre(Access=SA_Read)] int x);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f ([Pre(Access=Read)] int x);

In C++, it is optional to use SA_ prefix.

See Also

Other Resources

Annotation Properties