You declare variables like this in C# (the syntax we'll use is standard for C# documentation—items in square brackets are optional, and items in italics are placeholders for your own identifiers):

[attributes] [modifiers] type declarators;

Here are the parts of this statement:

  • attributes (optional)— Holds optional declarative meta-information, as we'll discuss in Chapter 14, “Using Attributes and Reflection.”

  • modifiers (optional)— Optional modifiers that include the new modifier and one of the four access modifiers like public and private that we'll see in Chapter 3.

  • type One of the C# types—byte, char, short, int, long, float, double, decimal, bool, string, an enum—or a reference type.

  • declarators A comma-separated list of declarators. ...

Get Microsoft® Visual C#® .NET 2003 Kick Start now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.