Compartilhar via


Set bit flags

 

Applies To: Dynamics CRM 2013

Bit-level manipulation is a common practice to conserve space in programs. Eight Yes/No, On/Off bits of data may be stored in a single byte instead of using up 8 bytes. The AccessMask property is an example of this kind.

Example

The following example shows how to turn on or off the specified display flag for an attribute.

//Turn flag on
    _currentAccessRights |= AccessRights.ReadAccess;
//Turn flag off
    _currentAccessRights &= ~AccessRights.ReadAccess;

// Test to see if flag is set
If (_currentAccessRights.HasFlag(AccessRights.ShareAccess))
    // Flag is set.

See Also

AccessMask
Best practices for developing with Microsoft Dynamics CRM 2013
Blog: A Quick Bitmask How to for Programmers