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

مشاهدة النسخة كاملة : Basic Question: Conversion



C# Programming
12-01-2009, 04:30 PM
Hello. Until now I always used conversion through Convert class. Example:

Int32 nInt = Convert.ToInt32("12345");

With that above I always used Try Catch to handle incorrect conversion. Lately I saw there can be achieved by using Int32.TryParse().

So which approach should be better, and what are good and cons of each method?

Thanks in Advance