List Info

Thread: Interview Questions Feb 25, 2006




Interview Questions Feb 25, 2006
user name
2006-02-25 12:13:27
What's the difference between Convert.toString and
.toString() method
?

Just to give an understanding of what the above question
means seethe
below code.

int i =0;

MessageBox.Show(i.ToString());

MessageBox.Show(Convert.ToString(i));

We can convert the integer "i" using
"i.ToString()" or
"Convert.ToString" so what's the difference.
The basic difference
between them is "Convert" function handles NULLS
while
"i.ToString()" does not it will throw a NULL
reference exception
error. So as good coding practice using
"convert" is always safe.

Full Interview Questions for .NET and SQL Server
http://www
.geocities.com/dotnetinterviews/
Help the community to make job search easier mail your
questions to
jobatyourdoorstepyahoo.co.in
Looking for a onsite job mail your resumes at
jobatyourdoorstepyahoo.co.in


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C# Developers" group.
To post to this group, send email to CSDevelopersgooglegroups.com
To unsubscribe from this group, send email to
CSDevelopers-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/CSDevelopers
-~----------~----~----~----~------~----~------~--~---

Interview Questions Feb 25, 2006
user name
2006-02-25 21:40:22
omg you must be joking with this one :

> We can convert the integer "i" using
"i.ToString()" or
> "Convert.ToString" so what's the
difference. The basic difference
> between them is "Convert" function handles
NULLS while
> "i.ToString()" does not it will throw a
NULL reference exception
> error. So as good coding practice using
"convert" is always safe.

The real difference is something else,
please take a look at the IML code of both options...
x.ToString(); is much more extensible code because the
ToString() is
declared virtual, in a OO world you want to use this one and
not the
static crap on the Convert class.

Jobs wrote:
> What's the difference between Convert.toString and
.toString() method
> ?
>
> Just to give an understanding of what the above
question means seethe
> below code.
>
> int i =0;
>
> MessageBox.Show(i.ToString());
>
> MessageBox.Show(Convert.ToString(i));
>
> We can convert the integer "i" using
"i.ToString()" or
> "Convert.ToString" so what's the
difference. The basic difference
> between them is "Convert" function handles
NULLS while
> "i.ToString()" does not it will throw a
NULL reference exception
> error. So as good coding practice using
"convert" is always safe.
>
> Full Interview Questions for .NET and SQL Server
> http://www
.geocities.com/dotnetinterviews/
> Help the community to make job search easier mail your
questions to
> jobatyourdoorstepyahoo.co.in
> Looking for a onsite job mail your resumes at
> jobatyourdoorstepyahoo.co.in


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C# Developers" group.
To post to this group, send email to CSDevelopersgooglegroups.com
To unsubscribe from this group, send email to
CSDevelopers-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/CSDevelopers
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )