How to hide a method?

Is there no other way, maybe with an attribute, to hide a method? Now I need to call Shell.List to access methods, otherwise I need to specify all methods in Shell class if I what them to bee accessed directly.
public class Shell{
   private class MyList : List<object>, IAllowableFunctions{
      //define functions here
   }
   
   public interface IAllowableFunctions{
      //define functions u want to be declared public here
      void Add();
 
      void Remove();
   }
 
   private MyList list;
 
   public Shell(){
      list = new MyList();
   }
 
   //returns back a IAllowableFunctions interface that only
   //has access to the listed functions
   public IAllowableFunctions List{
      get{ return list; }
   }
}

Open in new window

HOVEAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

silemoneCommented:
change them to private...use reflection and you can change the public, private, etc...of a method...
0
silemoneCommented:
hmm...pls explain more...
0
HOVEAuthor Commented:
That is it you are talking about, just be more specific. What to use from System.Reflection and how?
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

silemoneCommented:
I'm leaving right now, but I will let you know later tonight...
0
HOVEAuthor Commented:
To clarify, I need to hide some system base class public methods.
0
HOVEAuthor Commented:
Pardon me, not system base class, but system class public methods in derived class.
0
silemoneCommented:
I spoke too soon...from my java background you can do this with reflection...at least back in 1.5.1...looking at this:

http://stackoverflow.com/questions/106383/c-can-publicly-inherited-methods-be-hidden-eg-made-private-to-derived-class 

it appears you can't in java...

however, look at the last response (read all of them...they are interesting) for Method hiding...
0
silemoneCommented:
I spoke too soon...from my java background you can do this with reflection...at least back in 1.5.1...looking at this:

http://stackoverflow.com/questions/106383/c-can-publicly-inherited-methods-be-hidden-eg-made-private-to-derived-class

it appears you can't do in C# what you can in java...

however, look at the last response (read all of them...they are interesting) for Method hiding...
0
silemoneCommented:
did that work out for you?  did you use 'new' keyword to hide method?
0
HOVEAuthor Commented:
If you change methods access modifier and add a new keyword, you could still access base public method. That didn't help me, I gave up on method hiding.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.