• Randy Glenn (unregistered)

    Wow.

  • Anthony (unregistered)

    But what will he do if the String class changes? :-)

  • Thomas Eyde (unregistered)

    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.

  • Hristo Deshev (unregistered)

    Does p_i stand for "integer parameter"? Gimme a break!

  • T1TAN (unregistered)

    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.. :)

  • Thomas Eyde (unregistered)

    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!)

  • vbNullString (unregistered)

    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

  • Paul D. Murphy (unregistered)

    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.

  • David L. Penton (unregistered)

    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.

  • Jason Walker (unregistered)

    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...

  • Eric Peterson (unregistered)

    "...DoubleWrapper..."

    Can I get that with cheese and a super-sized order of fries?

Leave a comment on “Class IntWrapper”

Log In or post as a guest

Replying to comment #:

« Return to Article