Web Log di Adrian Florea

"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
posts - 440, comments - 2715, trackbacks - 3944

My Links

Archives

Post Categories

Image Galleries

.RO Blogs

.RO People

.RO Sites

Blogs

Furls

Links

vinCitori

Enums with a single default value

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):

namespace Microsoft.SharePoint.Portal.SingleSignon
{
    public class Credentials
    {
        //...
 
        public static void ReserveCredentialTicket(Credentials.SingleSignonTicketType Type, string strTicket)
        {
            //...
        }
 
        public enum SingleSignonTicketType
        {
            Default
        }

    }
}

Abbastanza bruttino direi.

Print | posted on martedì 9 maggio 2006 11:06 | Filed Under [ Pattern Dappertutto ]

Powered by:
Powered By Subtext Powered By ASP.NET