Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cast vs .ToString()
Message
From
15/12/2003 14:26:25
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Cast vs .ToString()
Miscellaneous
Thread ID:
00859235
Message ID:
00859235
Views:
64
Anybody know off-hand which is faster (or does it really matter <g>)? I would think that the cast would be faster, or better, but I don't really know.
string x = row["MyColumn"].ToString();
or
string x = (string)row["MyColumn"];
This is assuming that you already know that row["MyColumn"] cannot be DBNull.Value.

TIA,
~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Next
Reply
Map
View

Click here to load this message in the networking platform