Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6858183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:07:33+00:00 2026-05-27T02:07:33+00:00

my function has the following signature function myfunction(ref object) I use it as such

  • 0

my function has the following signature

function myfunction(ref object)

I use it as such

 Array arr = Array.CreateInstance(System.Type.GetType("System.String"), 2);
  arr.SetValue("1", 0);

  myfunction( ref arr);

And I am getting

“cannot convert from ‘ref System.Array’ to ‘ref object'”

I was under the impression that System.Array is object …so why am I getting this error? Is object different from Object?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:07:33+00:00Added an answer on May 27, 2026 at 2:07 am

    Think of ‘ref object’ as “I take a reference to a variable that can store an Object”. Suppose that ‘myfunction’ tried to store an ‘int’ to the variable you passed? This would fail at runtime, which is undesirable.

    On a side note, you can use typeof(string) in place of calling GetType(“System.String”). You can also just say:

    Object arr = new string[2];
    

    To access the array first, you can do this:

    string[] arr = new string[2];
    arr[0] = "1";
    object arrObj = arr;
    myfunction(ref arrObj);
    

    I would double check that you’re using the method myfunction correctly; it’s a rather unusual parameter type for taking an initialized array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use a function that has the following signature to sign a
In C the atan2 function has the following signature: double atan2( double y, double
I have a custom control that has the following prototype. Type.registerNamespace('Demo'); Demo.CustomTextBox = function(element)
PHP's mkdir function has the following signature: bool mkdir ( string $pathname [, int
I have been trying to call a C function that has the following signature
I'd like to create a function that has the following signature: public String createString(int
According to PHP's official documentation the imagepng() function has the following signature: bool imagepng
I want to write a function in F#, that exposes the following type signature
Currently CComPtr::operator= is implemented using a helper function AtlComPtrAssign() that has the following signature:
A template function I have written has the following signature: template<class IteratorT> auto average(IteratorT&

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.