Why do you use booleans in [WordProcessingDocument|SpreadsheetDocument|PresentationDocument].Open instead of enums? RRS feed

  • Question

  • Why do the Open methods of the WordProcessingDocument, SpreadsheetDocument, PresentationDocument take a "readWriteMode" as a boolean? Wouldn't it make far more sense to use something like a System.IO.FileAccess enum? In fact, the OpenXmlPackage.OpenCore function internally converts the boolean to a FileAccess anyway.

    Furthermore, the boolean approach drifts away from Framework Design Guideline recommendations. I like the new API and don't want to see it have methods that start to look like Method(true,false,true). Please strongly consider using much more readable enums than booleans. In addition, it'll make it similar to System.IO.File.Open and System.IO.Packaging.Package.Open.

    I've just started to work with the SDK, so I noticed it on this method first. The same concept might apply elsewhere too.

    Again, thanks for the great API -- I think with a few tweaks like this, it'll really shine.

    Tuesday, July 31, 2007 10:22 PM