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. Web Development
  3. ASP.NET
  4. returning values form jagged arrays

returning values form jagged arrays

Scheduled Pinned Locked Moved ASP.NET
data-structureshelp
2 Posts 2 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.
  • M Offline
    M Offline
    mehnazash
    wrote on last edited by
    #1

    hi, i want to know how should i return values from jagged arrays public string[][] fync(Type webtype) { string[][] dimen= new string[3][]; dimen = getDetails(Type Webtype); //how should i collect values in dimen } public string[][] getDetails(Type webtype) { //suppose ss is jagged array of dimension ss[3][] //ie i have ss[0] = i have something // ss[1]= i have something else // ss[2]= i have some third item return ss; } I hope i am doing right help please Thanks JIny

    G 1 Reply Last reply
    0
    • M mehnazash

      hi, i want to know how should i return values from jagged arrays public string[][] fync(Type webtype) { string[][] dimen= new string[3][]; dimen = getDetails(Type Webtype); //how should i collect values in dimen } public string[][] getDetails(Type webtype) { //suppose ss is jagged array of dimension ss[3][] //ie i have ss[0] = i have something // ss[1]= i have something else // ss[2]= i have some third item return ss; } I hope i am doing right help please Thanks JIny

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      A jagged array is just an array of arrays. To create one you first create the main array, then create each sub-array:

      string[][] ss;
      ss = new string[3][];
      ss[0] = new string[] { "Some", "strings" };
      ss[1] = new string[] { "Some", "more", "strings" };
      ss[2] = new string[2];
      ss[2][0] = "Individual";
      ss[2][1] = "strings";

      When you get the jagged array from the function, you shouldn't create an array first. That only means that you create an array that you will just throw away. Just declare the reference for the array:

      string[][] dimen;
      dimen = getDetails(webtype);

      --- b { font-weight: normal; }

      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