By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,146 Members | 1,631 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,146 IT Pros & Developers. It's quick & easy.

Does C# have Type Wrappers?

P: n/a
Hey folks,

Is it possible to create Type Wrappers in C#? If so, how do you do it?

For those not sure of what I mean, here's a quick link on Type Wrappers in
Java: http://home.cogeco.ca/~ve3ll/jatutor5.htm#tw

Thanks!
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
John Smith <js@no.com> wrote:
Is it possible to create Type Wrappers in C#? If so, how do you do it?

For those not sure of what I mean, here's a quick link on Type Wrappers in
Java: http://home.cogeco.ca/~ve3ll/jatutor5.htm#tw


There's no need, due to boxing. However, your page has:

"Simple datatypes are passed by value and not by reference."

That suggests that you think reference type parameters in Java are
passed by reference - they're not, the reference is passed by value.
There's a difference between reference passed by value and value passed
by reference.

See http://www.pobox.com/~skeet/java/passing.html for more information.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

P: n/a
Type wrapping is not needed in C# because the language will create an object
and place a value type into it when it is needed. This is called "boxing".
The inverse is to unwrap the value type from the object, which is called
"unboxing." The gyrations caused by Java's decision not to derive the base
types from the type "object" is simply not present in C#

Hope this helps,
--- Nick

"John Smith" <js@no.com> wrote in message
news:uQ*************@TK2MSFTNGP09.phx.gbl...
Hey folks,

Is it possible to create Type Wrappers in C#? If so, how do you do it?

For those not sure of what I mean, here's a quick link on Type Wrappers in
Java: http://home.cogeco.ca/~ve3ll/jatutor5.htm#tw

Thanks!

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.