The basic difference
is "variable.toString()"
does not handle NULL value it throws null exception error but Convert.toString(variable)
handle NULL value even if variable value
becomes null.
Example:-
// throws a null
exception error
string
str;
int i =
null;
str = i.ToString();
// return empty
string values for str and does not throw exception
string
str;
int i =
null;
str = Convert.ToString(i);
No comments:
Post a Comment
Note: only a member of this blog may post a comment.