Re: Protecting methods
- From: "Daniel O'Connell [C# MVP]" <onyxkirx@xxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 3 Nov 2005 03:35:12 -0600
"KenA" <KenA@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C31AAF67-632C-467E-B295-F70C0A785DC5@xxxxxxxxxxxxxxxx
> Suppose that in the class named the ProductDB.cs I want to protect the
> method logic from being accessed from other classes, but I still want to
> let
> other classes to call the method. The protected method is:
>
> private static ArrayList ReadProducts()
> {
> ...all the logic to goes here
> }
>
> In order to let other classes to access this method I then create a public
> method that just calls the private method, like:
>
> public static ArrayList GetProducts()
> {
> return ReadProducts();
> }
> private static ArrayList ReadProducts()
> {
> ...all the logic to goes here
> }
>
> Is it a good design for this idea?
It doesn't appear to get you anything at all, so why not just make the other
one public? How exactly is that protecting the method logic? Are you talking
with an obfusticater?
.
- Prev by Date: why can't vs 2005 class designer do UML
- Next by Date: Thread and "callbacks"
- Previous by thread: why can't vs 2005 class designer do UML
- Next by thread: Re: Protecting methods
- Index(es):
Relevant Pages
|
Loading