title: Bitwise or on a variable amount of numbers C#
body: <p>I am building an upload form for iTextSharp using the MVC4 framework and I'm getting stuck trying to translate Boolean values to a bitwise integer.</p>
  
  <p>The method iTextSharp offers uses bitwise or to combine multiple parameters like so:</p>
  
  <pre><code>    PdfEncryptor.Encrypt(new PdfReader(
                      ms.ToArray()),
                      fs,
                      true, 
                      null, 
                      "Pw", 
                      PdfWriter.ALLOW_COPY | PdfWriter.ALLOW_FILL_IN .......);
  </code></pre>
  
  <p>However, I defined my model to use Boolean properties so it's easy to hook to a webform.</p>
  
  <pre><code>internal static class PermissionConstants
  {
      public const int NumAllowAssembly = 1024;
      public const int NumAllowCopy = 16;
      public const int NumAllowDegradedPrinting = 4;
      public const int NumAllowFillIn = 256;
      public const int NumAllowModifyAnnotations = 32;
      public const int NumAllowModifyContents = 8;
      public const int NumAllowPrinting = 2052;
      public const int NumAllowScreenReaders = 512;
      public const int NumHideMenubar = 8192;
      public const int NumHideToolbar = 4096;
      public const int NumHideWindowUI = 16384;
  }
  
  public class Permissions
  {
      public bool AllowAssembly { get; set; }
      public bool AllowCopy { get; set; }
      public bool AllowDegradedPrinting { get; set; }
      public bool AllowFillIn { get; set; }
      public bool AllowModifyAnnotations { get; set; }
      public bool AllowModifyContents { get; set; }
      public bool AllowPrinting { get; set; }
      public bool AllowScreenReaders { get; set; }
      //[System.ComponentModel.DefaultValue(true)]
      public bool HideMenubar { get; set; }
      //[System.ComponentModel.DefaultValue(true)]
      public bool HideToolbar { get; set; }
      //[System.ComponentModel.DefaultValue(true)]
      public bool HideWindowUI { get; set; }
  
      public Permissions()
      {
          HideMenubar = true;
          HideToolbar = true;
          HideWindowUI = true;
      }
  }
  </code></pre>
  
  <p>Now the problem is sending the values from the Permissions Class to the first method.  I'd like to make a method that generates the right number.  Does anyone know how to do this? Is it possible to just add integers?  I don't think that results in the same numbers as the bitwise or operation.</p>