Skip to Content
Beginning Visual C#® 2005
book

Beginning Visual C#® 2005

by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White
November 2005
Beginner
1104 pages
28h 36m
English
Wrox
Content preview from Beginning Visual C#® 2005

5

More about Variables

Now that you've seen a bit more of the C# language, it's time to go back and tackle some of the more involved topics concerning variables.

The first topic you look at in this chapter is type conversion, where you convert values from one type into another. You've already seen a bit of this, but you look at it formally here. A grasp of this topic gives you a greater understanding of what happens when you mix types in expressions (intentionally or unintentionally) and tighter control over the way that data is manipulated. This helps you to streamline your code and avoid nasty surprises.

Once you've covered this, you will look at a few more types of variable that you can use:

  • Enumerations: Variable types that have a user-defined discrete set of possible values that can be used in a human-readable way
  • Structs: Composite variable types made up of a user-defined set of other variable types
  • Arrays: Types that hold multiple variables of one type, allowing index access to the individual values

These are slightly more complex than the simple types you've been using up to now, but they can make your life much easier.

Once you've covered these topics, you look at another useful subject concerning strings — basic string manipulation.

Type Conversion

Earlier in this book you saw that all data, regardless of type, is simply a sequence of bits, that is, a sequence of zeros and ones. The meaning of the variable comes through the way in which this data is interpreted. The ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Visual C# 2010

Beginning Visual C# 2010

Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon Reid, Morgan Skinner
Professional C# 2008

Professional C# 2008

Christian Nagel, Bill Evjen, Jay Glynn, Morgan Skinner, Karli Watson
Professional C# 2005

Professional C# 2005

Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Allen Jones

Publisher Resources

ISBN: 9780764578472Purchase bookDownloads