المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How well do you know your TryParse()?



C# Programming
04-15-2012, 04:01 AM
What would you expect foo to be after this code fragment runs? Post your answer without first peeking at the docs! http://www.barakasoft.com/script/Forums/Images/smiley_biggrin.gif
string badNumericString = "Bogus"; Decimal foo = Decimal.MinValue; bool status = Decimal.TryParse (badNumericString, out foo); // status is false, as expectedAnswer:

Decimal.MinValue (since the parse failed)
Something else (if so, what?)
/ravi
My new year resolution: 2048 x 1536
Home (http://ravib.com) | Articles (http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=191) | My .NET bits (http://ravib.com/dotnetbits/) | Freeware (http://ravib.com/freeware.htm)
ravib(at)ravib(dot)com