If you’re not following along while going through the book or aren’t already ahead of my knowledge curve, this post may possible just shoot way over you head. I’ll try to keep it from shooting too far, but I can’t guarantee anything.
Chapter 9 has us creating a c# based class file.
Quite a few posts ago I’d written a blog regarding classes – superclasses, parent, and children. Well at the very beginning of the C# documents, the first thing specified are the classes which each document is referencing – inheriting.
In regard to this set, Victor’s book says that I should see the following collection:
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
But that’s not how Visual Studio 9 (final release plus SP1) created my C# class file. It created it like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
…
I was in the middle of writing that I was hoping that it wouldn’t be a problem that I don’t have something which is displayed in a later portion where the author is having us add an item – but now that I’m typing it and flipping back and forth between the pages, I’ve discovered something odd.
Look at the first set of classes in this post. Now check this out – page 194 of Chapter 9 has him directing us to add something called, “System.Collections.ObjectModel;” But wait – that’s already there. Or well – it has been the entire time he’s showing us what our code should look like. He’s even bolded it. What I AM seeing is soemthing else which is quite interesting. An addition which is not mentioned and not previously shown.
Excerpt from the book –
… (see the following bolded code).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.ComponentModel;
I’m not so concerned regarding the bolded – because it was placed there by Visual Studio. What I want to know about is where the heck did using System.Linq and using System.ComponentModel; come from? My Visual Studio already had .Linq but I don’t have the “ComponentModel”.
I’m going to add it to my code but… what the heck?
Edit: Page 196 he shows us what the code is supposed to look like entirely. System.Linq is not a part of this example!
The actual C# the author steps you through adding – I wouldn’t have been able to get myself through that on my own. As I work with C# more, I believe that I could, but at this point, I comprehend what the code is doing, but I know that I wouldn’t have been able to engineer it from “thin air”.