This post originated from an RSS feed registered with .NET Buzz
by Adrian Florea.
Original Post: Enums with a single default value
Feed Title: Web Log di Adrian Florea
Feed URL: /error.aspx?aspxerrorpath=/adrian/Rss.aspx
Feed Description: "You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away." Antoine de Saint-Exupery
Nel libro di Cwalina & Abrams (p. 93), la regola "avoid publicly exposing enums with only one value" ha questo commento:
"A common practice for ensuring future extensibility of C APIs is to add reserved parameters to method signatures. Such reserved parameters can be expressed as enums with a single default value. This should not be done in managed APIs. Method overloading allows adding parameters in future releases."
E' proprio il caso del enum nidificato SingleSignonTicketType (SharePoint Portal Server 2003), creato solo per "riservare" il parametro Type nel metodo ReserveCredentialTicket, metodo a cui corrisponde la procedura esterna dallo stesso nome (vedi la DLL unmanaged ssocli.dll):