Session 3
20. september 12:15-15:45 at location D211

Plan and notes - Preparation - Exercises - Extra

Plans and notes

The Basic book to reference to is C# for Studens, Douglas Bell & Mike Parr, Addison Wesley


Writing classes  - litterature chapter 10:

  • Class versus object (class instance)
  • Encapsulation
  • Object variables
  • Constructors
  • Object methods
  • Class variables (static)
  • Class methods (static)
  • Properties versus normal methods
  • Equality - object versus objects value - reference versus value

Writing classes with normal overriding and implemented methods:

  • ToString - override from class object
  • CompareTo - implementing interface IComparable
  • Clone - implementing interface ICloneable
  • (Equals - override from class object)

Using a collection for containing several objects:

  • Intro to the System.Collections.ArrayList class
    • Create a new ArrayList collection object with new
    • Add
    • Remove
    • Contains - uses the Equals methods
    • Clear
    • Clone
    • Reverse
    • Sort - objects must implement the IComparable interfase with the CompareTo method


  • Using a listbox on a windows-form - litterature chapter 13


I will talk about the topics in generel and try to give short examples.
You will work with new excersises.



The exercises from session 2 must be done before this session

Read about the topics you didn't understand from the last session - if you haven't got the book se at the toturial links at the course site

Try to figure out what you already know about the new topics, and what you guess about the rest.

Read about the topics you don't know something about - if you haven't got the book se at the toturial links at the course site



The exercises from the last session must be done before this session

New exercises to be started in this session and to be solved before the next session


Extra materials

Extra materials from the last session

Extra materials from this session (may be added after the session)