Wednesday, September 24, 2003

int.Parse() vs. Convert.Int32()

the following i found on the internet:

Everytime I have to convert a string to an integer I use int.Parse() instead of Convert.Int32(). Until today, I basically recommended it because it looked more O-O to me (besides, I get the chance to pick my Java pals because int behaves more like a real class in C# ;-). But today Clemens Vasters, a fellow RD, gave me a really sound reason for doing so: int is a higher level abstraction than Int32 and, by default, higher level abstractions are friends of the (business) developer. Nice one, Clemens.

My friend luiz wrote :

I agree... At first look they look quite the same but using int.Parse() seems to be the better approach... If one of these days the pattern changes and the int becomes a Int64 for example you dont need to worry about it.



No comments:

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: Its free and easy to use, we provide all sources at codeplex.

Facebook Badge