O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Defining Methods

A method can be defined as either a static or an instance member, which influences what state is available to it. You’ve seen the use of a special static method plenty of times, namely an application’s entry point Main method:

class Program{    static void Main(string[] args)    {        ...    }}

Of the modifiers available on a method declaration, we’ve only used the static one. Many other modifiers exist to specify things such as visibility (public, private, internal, and the object-oriented [OO]-related protected and protected internal access modifiers). You’ll see more of those modifiers in Chapter 14, “Object-Oriented Programming,” including abstract, virtual, override, sealed, and new.

The declaration of a method consists ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required