Welcome to the GDNet C# Workshop – Ch. 1 & 2
For a complete introduction to this workshop, please look here.
Workshop Overview
This workshop is designed to aid people in their journey to learn beginning C# (C-Sharp). This workshop is targeted at highly motivated individuals who are interested in learning C# or who have attempted to learn C# in the past, but found that without sufficient support and mentoring they were unable to connect all the pieces of this highly complex but powerful programming language. This is a 'guided' self-teaching C# workshop. Each student is responsible for taking the time to read the material and learn the information.
Additionally, this workshop does not attempt to defend C# as a language, nor does it attempt to demonstrate that C# is either more or less useful then other programming languages for any particular purpose. People who intend to start a discussion about the differences between C# and ANY other languages (except as are relevant to a particular discussion), are encouraged to do so elsewhere. This workshop is for educational, not philosophical discussions.
Finally, the community and tutors that arise out of this workshop are here for making the learning process run more smoothly, but are not obligated to baby-sit a person's progress. Because everyone will be working from the same references (
.NET Book Zero and optionally the C# Language Specification
1.2 &
2.0), students may find it easier to get answers to the specific questions they might have. There is no minimum age requirement, and there is no previous programming experience required. However, we will be moving quickly so it's essential that students stay on task and dont fall behind.
Experienced C# Programmers
Feel free to post your own additional knowledge about the topics, however please try and keep the information you provide objective. If you MUST provide subjective/opinion-based information, please do so by marking the paragraph with
[opinion] tags. This will make it clear to the readers what is fact, and what is opinion. Also, it may be relevant to mark some information with
[observation] tags for information which you’ve “observed” but may not be fact. Finally, if you’re providing information which is related to common programming errors, you might tag it with a
[warning] tag. Also, feel free to post links to additional resources about the topics for this week. I will do my best to add those to the “Additional Resources” section at the bottom of this post.
Quizzes & Exercises
Each week I will post review questions and exercises in the weekly thread. Please try and answer them by yourself. Once you've done so, feel free to look over the answers provided by others and submit your own answers if you've not yet seen them posted yet. Discussion about the quiz questions and answers is encouraged for clarification. Finally, experienced C# programmers may feel free to post quiz-like questions and exercises of their own.
Chapters 1 & 2 – Introduction & Lexical Structure
Introduction
Greetings everyone and welcome to the C# Workshop. This week we begin the workshop with what I effectionately call the "Everything and The Kitchen Sink" chapters. You see, books on programming languages often try and cover tiny bits of information at a time, only showing you the information on a "need to know" basis. However, the majority of programming languages aren't implemented in bite-size chunks. They're complicated, intertwined devices necessarily complex for the purpose of doing complex things. Think about it...would it make much sense to teach English only by teaching the verbs first? "Dont worry, son, these verbs will all make sense when we've learned nouns in a few years." No. It would be frustrating as you wouldn't be able to put the verbs in context. As people who've previously read programming books can testify to, when the information is presented in bite-sized chunks, keeping relevant information from you until later, it's often common to answer questions with yet MORE questions. As well, you often find yourself saying "ooooh, so that's how this is used, I wish I'd known that 5 chapters ago when they first introduced it."
With that being said, the C# specification takes a different approach. They give you a complete overview of the entire language, from concept to implementation...in the first chapter. Is this overwhelming? Hell yes. I'll be honest with you, after reading the first two chapters you wont be able to write much more than a "Hello World" program. You're not going to know much about the syntax, however, you'll have received an invaluable survey of the language. As we come upon later chapters where the information in chapter 1 is presented in more depth, the terminology will have more meaning to you after having received this overview.
So in spite of the fact that you're likely to read these first two chapters and go uhhh....I dont get it, I encourage you not to give up. The purpose of the first two chapters isn't really to teach you the language, but instead to get you comfortable with the elements that make up the language. It's basically the teacher saying..."Well, this isnt going to teach you English, but...English is made up of Nouns, Verbs, Adjectives, etc..."
Outline of the Reading - Chapters 1 & 2
- Hello World
- Program Structure
- Types and Variables
- Expressions
- Statements
- Classes and Objects
- Structs
- Arrays
- Interfaces
- Enums
- Delegates
- Attributes
- Programs
- Grammars
- Lexical Analysis
- Tokens
- Pre-Processing Directives
Additional Resources
A good general overview of C# is located at the following URL, with decent descriptions and plenty of code samples. I highly encourage all complete programming beginners to check it out.
http://www.publicjoe.f9.co.uk/csharp1/csharp03.html
Good Luck!
[Edited by - JWalsh on July 21, 2007 10:30:37 PM]