Re: An object reference is required for the non-static field, method, or property
You've already found the problem before I got to the thread, but just for a bit of further explanation:
The key here is the age old one that gets many people when they're starting out with OO programming - the difference between an object and a class. You have just one class (of a particular type, in this case krnlboot) but you can have as many objects as you like, and these objects have different fields or attributes. One instance of (or one object of type) krnlboot can have a totally different "Size" to another.
So you're getting the error here because you're referencing krnlboot.Size, the class, rather than an "instance of krnlboot".Size. In short, the compiler doesn't know *what* object of type krnlboot you want the size of. When you use *this.Size* you're explicitly telling the compiler you want the "Size" of this particular object that you're working with at the moment - hence it knows exactly what object you're talking about, and the error disappears.
__________________
Save the whales, feed the hungry, free the mallocs.
|