News for hackers. Stuff that matters.
Re:C# Extension Methods Demystified by fryguy on Thursday March 28, 2013 @06:44PM (#5458166)
I'm not OP, but something like:

        public static int ToInt(this BaudRate baudRate)
        {
            switch (baudRate)
            {
                case BaudRate.BaudUnsupported:
                    return 0;
                case BaudRate.Baud1200:
                    return 1200;
                case BaudRate.Baud2400:
                    return 2400;
                case BaudRate.Baud4800:
                    return 4800;
                case BaudRate.Baud9600:
                    return 9600;
                case BaudRate.Baud19200:
                    return 19200;
                case BaudRate.Baud38400:
                    return 38400;
                case BaudRate.Baud57600:
                    return 57600;
                case BaudRate.Baud115200:
                    return 115200;
                case BaudRate.Baud230400:
                    return 230400;
                default:
                    throw new ArgumentOutOfRangeException("baudRate");
            }
Not exactly the best example (and not necessarily the best way to do that), but it's a quick one.

There are no comments on this comment yet.