W
William Stacey
Example line:
string temp = Convert.ToString(null);
Convert.ToString() says it will return empty string if null is passed as
parm. This returns a null. Is this oversight in the Convert method?
What is the way you guys are checking for nulls on string parms and triming
if they pass something other then null. I was thinking this would do in
most cases, but does not because of "error above"
private void testnull(string test)
{
test = Convert.ToString(test).Trim(); //one line would be nice.
if ( test == null ) //would rather check for "test" equals "" here, then
have to test for null first and then do a trim().
MessageBox.Show(this, "test2 is null.");
else
MessageBox.Show(this, "test2 is not null.");
}
--wjs
string temp = Convert.ToString(null);
Convert.ToString() says it will return empty string if null is passed as
parm. This returns a null. Is this oversight in the Convert method?
What is the way you guys are checking for nulls on string parms and triming
if they pass something other then null. I was thinking this would do in
most cases, but does not because of "error above"
private void testnull(string test)
{
test = Convert.ToString(test).Trim(); //one line would be nice.
if ( test == null ) //would rather check for "test" equals "" here, then
have to test for null first and then do a trim().
MessageBox.Show(this, "test2 is null.");
else
MessageBox.Show(this, "test2 is not null.");
}
--wjs