Passing a structure from one class to another class in a vb.net applications (VS2008) RRS feed

  • Question

  • I'm sure there are several ways of achieving my goal but I am after opinions on what you think is the best option.

    I'm writing a vb.net application which (amongst other thinks) interfaces with media players in the home. Because there are different types of media playersI'm trying to structure it so each type of media player has it's own class which interfaces to a management class which sits on top of all the different devices types.

    The device classes are responsible for discovering the phsyical devices and returning that information up to the management class. A device class may be responsible for monitoring 1 or more physical devices so..

    If I have a structure similar to the one belowwhat is the best way to access this from a different class running in the same application? Is it to bundle it up as XML and process it in the receiving class? Remember that it may have to pass back information regarding more than one of the same device...

    Thanks in advance





    Structure EvaHostTable


    Dim EvaHostName As String


    Dim EvaIPAddress As String


    Dim EvaClass As String

    Dim EvaCapabilities As String


    Dim EvaFlags As String


    End Structure

    Wednesday, April 7, 2010 12:09 PM



    Never place strings into a Structure.  Use a class instead.

    Your design questions are unanswerable.  Not enough info.  Either post code or describe your architecture using names of well known design patterns.  Visit www.dofactory.com for info about design patterns and GoF, the Gang of Four.

    Mark the best replies as answers. "Fooling computers since 1971."
    Wednesday, April 7, 2010 1:39 PM