473,386 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Does this cause boxing to occur?

Does this cause boxing to occur?

class Test
{
void myFunc(ref int theInt)
{
theInt = 10;
}

Test()
{
int x = 0;
myFunc(ref x);
}
}

So is x being boxed into an Object instance and passed by reference
that way and then unboxed back into an int? Or is it like C++ where
the address of x on the stack is really being passed & worked on w/o
any object creation happening?
Nov 16 '05 #1
1 1574
Hi,
Boxing doesn't happen here. Its just the address of the variable that is
passed to the function.

"Phill" <wa********@yahoo.com> wrote in message
news:ac**************************@posting.google.c om...
Does this cause boxing to occur?

class Test
{
void myFunc(ref int theInt)
{
theInt = 10;
}

Test()
{
int x = 0;
myFunc(ref x);
}
}

So is x being boxed into an Object instance and passed by reference
that way and then unboxed back into an int? Or is it like C++ where
the address of x on the stack is really being passed & worked on w/o
any object creation happening?
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: J.Marsch | last post by:
I don't know whether this is the appropriate place to give product feedback, but here goes: I would love to see some kind of diagnostic to let me know when implicit boxing has occurred. We...
0
by: Phill | last post by:
Does the following cause boxing/unboxing to occur? class Test { void myFunc(ref int x) { x = 10; } public Test()
3
by: Tariq | last post by:
This might sound like a stupid question, but anywas when you assign an int to a textbox via the textbox.text propperty I assume boxing happens. If this assigment happend too often rapidly on a...
14
by: dave.dolan | last post by:
Basically I'd like to implement the composite design pattern with leaves that are either of reference or value types, but even using generics I can't seem to avoid boxing (using ArrayList or...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.