In message <11**********************@o13g2000cwo.googlegroups .com>, Adam
<ad*********@hotmail.com> writes
I've seen lots of mentions of the scope of an "internal" class.
What's the scope of an "internal" method. Why would one use it as
opposed to an "internal" class?
Thanks in advance.
You may want a method on a public class which can be called by other
classes in the assembly, but not by clients of the assembly. Imagine you
have a container class managing a collection of Things. A Thing knows
how to delete its database record, but you want to ensure that when a
Thing is deleted, it is also removed from the collection:
public class ThingCollection
{
private Hashtable things;
public void DeleteThing(Thing toDelete)
{
toDelete.Delete();
this.things.Remove(toDelete.ID);
}
}
public class Thing
{
internal void Delete()
{
//Delete from database
}
}
--
Steve Walker