Methods

Methods embody a significant portion of a class's behavior. They are the primary mechanism whereby messages may be passed between objects. Each method within a class should be designed with a single purpose in mind. Furthermore, the purpose of the method should contribute to the role of the class and interact cohesively with other class members to support class goals.

Methods may be declared as either instance or static class members. Instance methods belong to the object instance of which they are a part. Static methods are invoked without an instance.

Instance Methods

Each object instance has its own separate method instances. Instance methods must be invoked on an instance of a class. Once this has happened, the method has access to ...

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.