C# Workshop - Week 10 (Ch. 27 - 28)

Started by
0 comments, last by Ezbez 16 years, 7 months ago

Welcome to the GDNet C# Workshop – Ch. 27 - 28

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 'quiz' 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. 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 27 - 28

Introduction Welcome to the Week 10 - The Final Week of the C# Workshop. Although there's still a few more weeks scheduled on the calendar, this is the final week of reading assignments. The remaining weeks, and thereafter, will be spent working on and improving the Final Project. With that said, the final reading assignment covers chapters 27 and 28 on Generics and Nullable Types. It's interesting that they saved these two for last, as they're both C# 2.0 features, and are more closely related than people initially realize. However, after reading the two chapters you'll have a good understanding on how to make Generic (Templated in other languages) types, and how to create Nullable value types which can be used with database tables or in other circumstances when a value-type might need a null value. Chapter 27 is all about generics, how to use them, how to create them, and what concerns you need when creating them. Specifically, when developing generic types you must keep in mind that without constraints (and to a degree with constraints) your code must work with ANY data type passed in. This can be a simple value type, or a complex reference type. Constraints help to make sure only types with the proper interface can be used, but even still, creating a generic class which can be used with all other types isn't easy. Chapter 28 builds upon Generics with the concept of the Nullable generic, and how it's used to allow people to create nullable value types. Petzold explores all of the features and most of the methods of the Nullable<> generic type, and then explores what compiler features were introduced, such as the nullable ? symbol to make working with nullable types. Well, that's the conclusion of the C# Workshop reading material. If you've got any questions, feel free to post them here in the C# Workshop - Week 10 Forum. As well, if you've liked my overviews, review questions, and exercises - let me know by giving me a positive rating. Good Luck on the Final Project! Additional Resources None...

Good Luck!

[Edited by - JWalsh on August 9, 2007 1:21:18 PM]
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Advertisement
Done!

Thanks for your hardwork, JWalsh. It has been appreciated!

[Goes off to get the projects done...]

This topic is closed to new replies.

Advertisement