1. Technology

C# Tutorial - Learn the Fundamentals of Programming


1 of 10

Understanding Variables and Types
IT engineer in office
Aping Vision/STS/Photodisc/Getty Images
The first two lessons have skimmed over some details of C# so this lesson looks at a few of the nuts and bolts of C# 2.0 Programming.


Any data that needs to be held in memory is stored temporarily in a location called a variable. It's variable because the value can be altered- ie it may vary during the lifetime of an application.

These are the main types of variables.

  • Numbers- Integer.
  • Numbers - Floating Point.
  • Enumerated Types - a limited set of integer values.
  • Bool - a true/false variable.
  • Chars.
  • Text Strings.
  • Arrays - a a multi dimensional list of variables.
  • Structs - A conglomerate variable.
  • Nullable Types.
  • Objects- A conglomerate of data plus methods (functions) that control access to the object's data.
  • Generic Types. Used for creating general classes that are instantiated for a particular type.
In this and the next lesson, we'll cover all these types apart from Generics which will require several lessons. Also text strings (and chars) will have a lesson of their own,

Numeric Variables

These divide neatly into two types- those that are whole numbers and have no fractional parts (called integers, int for short) and floating point numbers (float). CPUs use different parts of their silicon for working on floating point to integer. Integers are often smaller and faster to process.

On the next page : Integer Types

  1. About.com
  2. Technology
  3. C / C++ / C#
  4. C# / C Sharp
  5. Learn C Sharp
  6. C# Tutorial - Learn the Fundamentals of Programming

©2014 About.com. All rights reserved.