No veo nada malo en ofrecer como alternativa la propiedad indexada. La coherencia estaria asegurada si el nombre de la clase evoca a una lista o coleccion.
En definitiva, una cuestion de preferencias. ---------------------------------- Carlos Peix 2012/1/5 Oscar Onorato <[email protected]> > Gracias Carlos, > > Lo interpretaste como está propuesto y que me olvidé de explicar. Te > molesto con otra consulta ¿es necesario indexar esa propiedad o le quita > "coherencia en la codificación"? > > Muchas Gracias > > 2012/1/4 Carlos Peix <[email protected]> > >> Hola Oscar, >> >> No se entiende bien que significa "la region" pero, del texto que >> incluiste, entiendo que el metodo GetPrice y la propiedad indexada sirven >> exactamente para lo mismo: acceder al precio para la region a partir del >> precio base. >> >> Algun cliente podria usar este codigo: >> >> var precioBuenosAires = calcList.GetPrice(8); >> >> mientras que otro podria hacerlo asi: >> >> var precioBuenosAires = calcList[8]; >> >> Un saludo >> >> ---------------------------------- >> Carlos Peix >> >> On Wed, Jan 4, 2012 at 7:09 PM, Oscar Onorato <[email protected]>wrote: >> >>> Hola Cumpas, >>> >>> En el texto del "Asunto" me encontré con esto, mientras vienen >>> hablando de Modularización y/o Bajo Acoplamiento. >>> >>> public interface iCalcList >>> { >>> >>> *double this[int region]{get;}* >>> >>> double GetPrice(int region); >>> >>> double BasePrice { get; set; } >>> >>> } >>> >>> >>> Y el párrafo que le sigue dice lo siguiente, aunque no entiendo porqué >>> el índice, aunque lo explica no lo entiendo. >>> >>> Now we have an abstract type that represents any list of calculations. >>> Interfaces can be implemented by >>> just about any C# class, allowing other developers to define their own >>> versions of this business rule. >>> Although the calculations might be defined differently for each >>> implementation, every one of these >>> classes should expose an indexer for quick reference of the calculation, >>> a property named BasePrice , >>> where an instance ’ s original price can be set, and a method named >>> GetPrice that returns a calculated >>> value based on the region in which a customer lives. This abstract >>> interface is an important element of >>> design when it comes to building enterprise systems. They are a popular >>> approach to type decoupling, >>> which is needed when attempting to loosely couple classes that require >>> interaction. >>> >>> >>> Espero me puedan ayudar y, si falta que les adjunte otra parte del >>> código o de texto les pido tengan a bien avisarme. >>> >>> Felíz Año nuevo, y muchas gracias. >>> >>> Oscar R. Onorato >>> >> >> > > > -- > Oscar R. Onorato >
