What are the different named areas in c#?

I have never bothered to see what the different areas in c# called, I did programming and never bothered to ask what is these area called. I’ll post a picture to show what I mean. I’ve also looked online using google “c# script setup” with no prevail. Maybe someone here can help.

[16597-c#+names.jpg|16597]

The part at the top is called usings, here you declare which other namespaces you are going to use. Basically this says ‘Allow me to directly call classes from this namespace’ If you wont include ‘System.Collection.Generics’ you won´t be able to create a List like it is shown in the picture, you would have to use System.Collection.Generics.List

The big region is called class body, this contains every element of the class.
The class itself splits into:

  • Fields: Variables set inside the class
  • Properties: Like Fields but with get and set operator
  • Contructor: Used when creating a new instance of this class with new
  • Methods: Functions of this class

This is a very coarse overview, I recommend you to read about the different keywords, or dive through stackoverflow / msdn documentation for more information.

Here is a very good entry point about this topic!

Arkane is correct, but I can’t resist answering.

There is no science in naming parts of a script.

  1. I would call the beginning of the file, if you’re referring to the using directives (they can only be at the beginning). Otherwise I would call it outside the class.
  2. That area is within the class or inside sOrbitAndRotate or a combination thereof.
  3. No real name, as variables can be declared anywhere in the class. I’d possibly call this the beginning of the class
  4. in(side) the Start method
  5. in(side) the Update method

I’ve been taught to call any subroutine that returns void a method, and any subroutine that returns something else a function.