- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Wow.
Admin
But what will he do if the String class changes? :-)
Admin
Create a StringWrapper.
public class StringWrapper
{
private sealed int _value;
public StringWrapper(string s)
{
_value = int.Parse(s);
}
public int GetValue()
{
return _value;
}
}
Btw, is this a real beast? I saw that thing in Java the other day.
Admin
Does p_i stand for "integer parameter"? Gimme a break!
Admin
hhah... i like it! but we need to consider one thing.. there is a lack of DoubleWrapper, LongWrapper, FloatWrapper etc.. damn, who's gonna type all that code.. :)
Admin
The Whidbey edition will save us C#'ers with generics:
public class Wrapper<T>
(I think generics will give us lot's of unwanted fun!)
Admin
What the fuck... This guy just went too far, man. Does he think Microsoft is stupid enough to change Integer implementation dramatically? Dude, he should create another wrapper that wraps IntWrapper in case IntWrapper changes dramatically. LOL
Admin
I think what the guy did is just plain stupid, but in Whidbey Microsoft 'is' changing the implementation of Int32 in order to accomadate the potential for a null value. At least that was the talk back at the SDR.
Admin
Nullable Types was discussed on EricGu's blog: http://weblogs.asp.net/ericgu/archive/2004/05/27/143221.aspx
This isn't changing the Int32...it is introducing a new type based on the original type.
Admin
Yeah, the above code is retarted, but according to Maximizing .Net Performance from APress (pg 72), if you do something similar to this:
public class IntWrapper {
public int Int;
}
to use in a collection, that It can speed up the boxing/unboxing process by up to 4 times.
Go Figure...
Admin
"...DoubleWrapper..."
Can I get that with cheese and a super-sized order of fries?