Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Int Parameter as Object

Posted on 2006-04-24
3
Medium Priority
?
146 Views
Last Modified: 2010-04-16
I have a method that accepts an ref object as a parameter.  How can I pass an integer into that method as a ref object????

Thanks,
Kendal
0
Comment
Question by:gvector1
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 1000 total points
ID: 16526775
This is result of my test:

        static void Main(string[] args)
        {
            int n = 0;
            object o = n;

            Method(ref o);
            n = (int)o;

            Console.WriteLine(n);
        }

        static void Method(ref Object o)
        {
            o = 3;
        }
0
 
LVL 13

Assisted Solution

by:devsolns
devsolns earned 1000 total points
ID: 16526893
It will be automatic via Boxing.

http://www.google.com/search?hl=en&q=c%23+boxing
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question