The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Enums with a single default value

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Adrian Florea

Posts: 206
Nickname: adrian11
Registered: Jul, 2004

Adrian Florea is a .NET developer from Italy
Enums with a single default value Posted: May 9, 2006 12:44 AM
Reply to this message Reply

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
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Adrian Florea
Latest Posts From Web Log di Adrian Florea

Advertisement

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.

Read: Enums with a single default value

Topic: Aidy Who? Previous Topic   Next Topic Topic: [Recommendation] Larkware News : The Daily Grind

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use