title: Create Byte[] from DirectoryEntry C#
body: <p>Hello i have converted this example <a href="https://code.msdn.microsoft.com/windowsdesktop/VBGetUserGroupInAD-a94dc080" rel="nofollow">https://code.msdn.microsoft.com/windowsdesktop/VBGetUserGroupInAD-a94dc080</a> from VB .Net to C#
  But i don't know how I can translate the following code row:</p>
  
  <pre><code>'Get the objectSID which is Byte array
  Dim objectSid As Byte() = DirectCast(deTempForSID.Properties("objectSid").Value, Byte())
  </code></pre>
  
  <p>As I understod it have to be something like that, but i'm not sure, as it's not working and return array overflow:</p>
  
  <pre><code>byte[] objectSid = BitConverter.GetBytes(deTempForSID.Properties.Contains("objectSid"));
  </code></pre>
  
  <p>Plese can some one explain me how I can translate this code from VB .Net to C# correctly?</p>