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. Managed C++/CLI
  4. Jagged arrays in MC++

Jagged arrays in MC++

Scheduled Pinned Locked Moved Managed C++/CLI
questioncsharpc++comdata-structures
3 Posts 3 Posters 2 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.
  • A Offline
    A Offline
    Alexandru Savescu
    wrote on last edited by
    #1

    I have a managed class and I want to declare a jagged array of doubles as a member. How do I declare this and how do I initialize it? I can do that in C#, but I have syntax problems when it comes to __gc stuff :) Thanks! Best regards, Alexandru Savescu P.S. Interested in art? Visit this!

    N P 2 Replies Last reply
    0
    • A Alexandru Savescu

      I have a managed class and I want to declare a jagged array of doubles as a member. How do I declare this and how do I initialize it? I can do that in C#, but I have syntax problems when it comes to __gc stuff :) Thanks! Best regards, Alexandru Savescu P.S. Interested in art? Visit this!

      N Offline
      N Offline
      Natty Gur
      wrote on last edited by
      #2

      __wchar_t comma __gc[] = {L','};

      1 Reply Last reply
      0
      • A Alexandru Savescu

        I have a managed class and I want to declare a jagged array of doubles as a member. How do I declare this and how do I initialize it? I can do that in C#, but I have syntax problems when it comes to __gc stuff :) Thanks! Best regards, Alexandru Savescu P.S. Interested in art? Visit this!

        P Offline
        P Offline
        Paul Selormey
        wrote on last edited by
        #3

        Normally you use Array::CreateInstance() method to create the jagged array.

        using namespace System;
        using namespace System::Collections;

        public __gc class Test
        {
        Test()
        {
        Int32 lowerBounds[] = {200};
        Int32 lengths[] = {10};

        	\_array = Array::CreateInstance(\_\_typeof(Int32), lengths, lowerBounds);
        }
        

        private:
        Array __gc* _array;
        };

        You might wish to give a C# example of what you need if the above does not answer your question. Remember you can assign (cast) Array __gc* to []. Best regards, Paul. Jesus Christ is LOVE! Please tell somebody.

        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