title: Set/update inheritance flag permission on file/folder using C# error "No flags can be set. Parameter name: inheritanceFlags"
body: <p>I am creating a program that takes a text file containing permissions and applies those permissions to files/folders.<br>
  When I try to change the inheritance flags to either ContainerInherit or ObjectInherit I keep getting an error "No flags can be set. Parameter name: inheritanceFlags".<br>
  I don't get this error if I set the inheritance flag to None. This is my code:</p>
  
  <pre><code>if (flag.Equals("None"))
  {
      inheritFlag = InheritanceFlags.None;
  }
  else if (flag.Equals("ContainerInherit"))
  {
      inheritFlag = InheritanceFlags.ContainerInherit;
  }
  else if (flag.Equals("ObjectInherit"))
  {
      inheritFlag = InheritanceFlags.ObjectInherit;
  }                          
  
  FileSystemAccessRule fsarule = new FileSystemAccessRule(user, fileSysRight, inheritFlag, propFlag, controlType);
  fileSec.AddAccessRule(fsarule);
  File.SetAccessControl(currentFilePath, fileSec);
  </code></pre>
  
  <p>How do I set the inheritance flags without getting this error?<br>
  Thanks</p>