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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. What is the equivalent C# syntax of void SomeFunction( array<object^>^ &updatelist)

What is the equivalent C# syntax of void SomeFunction( array<object^>^ &updatelist)

Scheduled Pinned Locked Moved C#
csharpc++data-structureshelpquestion
3 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.
  • S Offline
    S Offline
    s196675m
    wrote on last edited by
    #1

    void SomeFunction( array<Object^>^ &updatelist) The above function is written using in VC++ managed systax. The equivalent of array<Object^>^ is Object[] I like to know what is the equalalent systax in C#. Important: There is a address symbol before the argument name, which means passing an array by reference so that the array can be change from inside the function. Any help is appreciated Thank you

    B 1 Reply Last reply
    0
    • S s196675m

      void SomeFunction( array<Object^>^ &updatelist) The above function is written using in VC++ managed systax. The equivalent of array<Object^>^ is Object[] I like to know what is the equalalent systax in C#. Important: There is a address symbol before the argument name, which means passing an array by reference so that the array can be change from inside the function. Any help is appreciated Thank you

      B Offline
      B Offline
      Bram Fokke
      wrote on last edited by
      #2

      I believe this is what you are looking for:

      void SomeFunction(ref object[] updateList) {
      if(updateList == null) {
      updateList = new object[10];
      }
      }

      S 1 Reply Last reply
      0
      • B Bram Fokke

        I believe this is what you are looking for:

        void SomeFunction(ref object[] updateList) {
        if(updateList == null) {
        updateList = new object[10];
        }
        }

        S Offline
        S Offline
        s196675m
        wrote on last edited by
        #3

        thank you for your suggession. Actually I should rephrase my words. The VC++ function resides in a dll. when I tried to call this function from C# code, the intellisence showed me the following function signature in C# void SomeFunction( object[]* obj); Now my question is ,how to pass a pointer to an array of object in C#. Suppose I have the following array and I want to pass this array to the above function. object[] obj = new object[4]; This array will be modified in the dll and should reflect the modification in the C# program. Thank you.

        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