Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Can you declare an array of mixed Types?

Can you declare an array of mixed Types?

Scheduled Pinned Locked Moved C#
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lecutus1
    wrote on last edited by
    #1

    Can you declare an array of mixed Types? I need have an array that contains: int key, form Control, form Monitor Form [50,3] Truck Is it possible? Thankx

    L D 0 3 Replies Last reply
    0
    • L Lecutus1

      Can you declare an array of mixed Types? I need have an array that contains: int key, form Control, form Monitor Form [50,3] Truck Is it possible? Thankx

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Object[]

      1 Reply Last reply
      0
      • L Lecutus1

        Can you declare an array of mixed Types? I need have an array that contains: int key, form Control, form Monitor Form [50,3] Truck Is it possible? Thankx

        D Offline
        D Offline
        DaveyM69
        wrote on last edited by
        #3

        Either create an object array as Harold sugested, or create a class that holds the various types you need in it's properties and create an array of your class - this will save a lot of boxing/unboxing.

        Dave
        BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
        Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

        1 Reply Last reply
        0
        • L Lecutus1

          Can you declare an array of mixed Types? I need have an array that contains: int key, form Control, form Monitor Form [50,3] Truck Is it possible? Thankx

          0 Offline
          0 Offline
          0x3c0
          wrote on last edited by
          #4

          Not yet; C# 4.0 brings in Tuples, but I don't know how these would interact with arrays and it hasn't be released yet

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups