Click here to Skip to main content
15,901,505 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to implement Pin
Colin Angus Mackay29-Jun-04 23:14
Colin Angus Mackay29-Jun-04 23:14 
GeneralRe: How to implement Pin
misterbear30-Jun-04 0:55
misterbear30-Jun-04 0:55 
GeneralRe: How to implement Pin
John L. DeVito30-Jun-04 8:17
professionalJohn L. DeVito30-Jun-04 8:17 
GeneralRe: How to implement Pin
Colin Angus Mackay30-Jun-04 8:56
Colin Angus Mackay30-Jun-04 8:56 
GeneralRe: How to implement Pin
John L. DeVito30-Jun-04 13:27
professionalJohn L. DeVito30-Jun-04 13:27 
AnswerRe: How to implement Pin
Werdna30-Jun-04 5:46
Werdna30-Jun-04 5:46 
GeneralRe: How to implement Pin
Werdna30-Jun-04 5:47
Werdna30-Jun-04 5:47 
GeneralCollection class with different class members Pin
pxp29-Jun-04 21:31
pxp29-Jun-04 21:31 
Hi all,

i would like to set up a logic like this:

A Collection class School which holds different class-members like:

* student
* teacher
* table
* chair
* classroom
* stairs

Member classes have different values (and methods), like:

- student   has: name, age and classroom <small>(link to classroom id?)</small>
- teacher   has: name
- table     has: pointF position, color and tabletype <small>(an enum)</small>- classroom has: pointF[] polyline, ID, classroomtype and MaxPersons
- stairs    has: pointF startpoint and pointF startpoint


I would like to get information for all elements in the main class collection using the foreach statement.
Then using it's type i can act on it. For a classroom i could show the position PointF[] on an image and for the students i could show only the students which are in that particular classroom.

Pseudo code:


Foreach element in MainSchoolCollection
  
  If element.type is typeClassroom
  
    // draw all points on a picture canvas
    PointF[] thePoints = element.vertices[]
    element.DrawMyClassroom(thePoints)
    // it's ID
    int ClassID = element.ID
    // All students which are in this classroom
    Foreach element in MainSchoolCollection
      If element.type is typeStudent
        MessageBox.Show(element.name)
      EndIf
    EndForeach
      
  EndIf
  
  If element.type is typeStairs
    // draw the line of the stair
    element.StairsToLine(element.startpoint, element.endpoint)
  EndIf
  
EndForeach



So the main issue is that each element in the collectionclass has different properties and methods. When looping through the main collection i would like to use/modify the element's property based on it's type.

Can anyone point me in the right direction here?

Thanks,

Me.
GeneralRe: Collection class with different class members Pin
Rakker7129-Jun-04 23:07
Rakker7129-Jun-04 23:07 
GeneralRe: Collection class with different class members Pin
pxp30-Jun-04 5:05
pxp30-Jun-04 5:05 
GeneralRe: Collection class with different class members Pin
Heath Stewart30-Jun-04 5:56
protectorHeath Stewart30-Jun-04 5:56 
GeneralRe: Collection class with different class members Pin
pxp30-Jun-04 7:32
pxp30-Jun-04 7:32 
GeneralRe: Collection class with different class members Pin
mav.northwind30-Jun-04 8:31
mav.northwind30-Jun-04 8:31 
GeneralRe: Collection class with different class members Pin
pxp30-Jun-04 23:41
pxp30-Jun-04 23:41 
GeneralRe: Collection class with different class members Pin
mav.northwind1-Jul-04 0:29
mav.northwind1-Jul-04 0:29 
GeneralRe: Collection class with different class members Pin
pxp1-Jul-04 3:28
pxp1-Jul-04 3:28 
GeneralRe: Collection class with different class members Pin
Heath Stewart30-Jun-04 8:35
protectorHeath Stewart30-Jun-04 8:35 
GeneralRe: Collection class with different class members Pin
pxp30-Jun-04 22:47
pxp30-Jun-04 22:47 
GeneralRe: Collection class with different class members Pin
Heath Stewart1-Jul-04 3:54
protectorHeath Stewart1-Jul-04 3:54 
GeneralRe: Collection class with different class members Pin
pxp1-Jul-04 4:05
pxp1-Jul-04 4:05 
Generalvariable object names Pin
rturner00329-Jun-04 20:13
rturner00329-Jun-04 20:13 
GeneralRe: variable object names Pin
Colin Angus Mackay29-Jun-04 20:49
Colin Angus Mackay29-Jun-04 20:49 
GeneralRe: variable object names Pin
Nick Parker30-Jun-04 3:15
protectorNick Parker30-Jun-04 3:15 
GeneralCPU time consuming program Pin
Mikke_x29-Jun-04 19:45
Mikke_x29-Jun-04 19:45 
GeneralRe: CPU time consuming program Pin
Colin Angus Mackay29-Jun-04 20:42
Colin Angus Mackay29-Jun-04 20:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.