Array of Struct

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jetean
    New Member
    • Feb 2008
    • 33

    Array of Struct

    Hi guys:
    I'm using C#, I'm trying to make struct in Array that is accessible globally (like VB6), Say I loaded value in to struct A in Form 1. I may want to access the same struct and modify something at Form2 or Form3.

    So how can I make it "globally"?
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by Jetean
    Hi guys:
    I'm using C#, I'm trying to make struct in Array that is accessible globally (like VB6), Say I loaded value in to struct A in Form 1. I may want to access the same struct and modify something at Form2 or Form3.

    So how can I make it "globally"?
    You may want to look into using Singleton pattern for this.

    I would make a class that allows other classes to get an instance of it's underlying data structure...the array. It's basically a Static (Shared) class that is used amongst your Forms.

    -Frinny

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Software patterns, just extra complexity :-P

      The static classes will accomplish your goal, at least as far as making it available to all forms.
      Are you having trouble with an array of structs?

      Comment

      Working...