Re: Protecting methods




"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?


.



Relevant Pages

  • Re: e mail address
    ... > Frank Saunders, MS-MVP, IE/OE ... > Please respond in Newsgroup only. ... > Protect your PC ... Prev by Date: ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Unable to open URL from OE message
    ... > Frank Saunders, MS-MVP, IE/OE ... > Please respond in Newsgroup only. ... > Protect your PC ... Prev by Date: ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Windows XP Built-in Backup Utility
    ... Frank Saunders, MS-MVP, IE/OE ... Please respond in Newsgroup. ... Protect your PC ... Prev by Date: ...
    (microsoft.public.windowsxp.basics)
  • Re: gun angle
    ... Win a Fulton Armory AR-15 rifle and protect your 2nd Amendment Rights too! ... Prev by Date: ...
    (rec.guns)
  • Frankford Arsenal headstamp identification
    ... Win a Fulton Armory AR-15 rifle and protect your 2nd Amendment Rights too! ... Prev by Date: ...
    (rec.guns)

Loading