Author Topic: TryParse for NET 2.0  (Read 1741 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
TryParse for NET 2.0
« on: February 05, 2006, 09:01:32 PM »
If you're a little tired of wrapping for Exceptions when using the Type.Parse(..) with NET 1.x ,

have a look at Type.TryParse(..) with NET 2.0 .. very nice I think ..

Code: [Select]
        static void ParseStuff()
        {
            string xString = "5";
            int xInt;

            bool result = int.TryParse(xString, out xInt);
        }
    }

« Last Edit: February 05, 2006, 09:09:26 PM by Kerry Brown »
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--