How do I pass a managed String Array to a function as a reference?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ken Varn

    How do I pass a managed String Array to a function as a reference?

    I have a C++ function in which I want to be able to new String Array object
    passed into it, but I can't get the syntax. Can someone help?

    Example:

    void MyFunc(String *MyString __gc[])
    {
    // I want to be able to do a new on MyString so that the caller gets the
    newed object.

    MyString = __gc new String * __gc[100];
    }

    I have tried passing the string as follows, but it won't compile:

    void MyFunc(String *&MyString __gc[]) ....

    --
    -----------------------------------
    Ken Varn
    Senior Software Engineer
    Diebold Inc.

    EmailID = varnk
    Domain = Diebold.com
    -----------------------------------


  • Tomas Restrepo \(MVP\)

    #2
    Re: How do I pass a managed String Array to a function as a reference?

    Hi Ken,
    [color=blue]
    >I have a C++ function in which I want to be able to new String Array object
    > passed into it, but I can't get the syntax. Can someone help?
    >
    > Example:
    >
    > void MyFunc(String *MyString __gc[])
    > {
    > // I want to be able to do a new on MyString so that the caller gets
    > the
    > newed object.
    >
    > MyString = __gc new String * __gc[100];
    > }
    >
    > I have tried passing the string as follows, but it won't compile:
    >
    > void MyFunc(String *&MyString __gc[]) ....[/color]


    The syntax you're looking for is:

    void MyFunc(String* (&MyString) __gc[])

    --
    Tomas Restrepo
    tomasr@mvps.org


    Comment

    Working...