Reputation: 3337
Just curious if there is some reason to use Convert.ToString(string value)
Upvotes: 3
Views: 107
Reputation: 223257
It does nothing, the original string is returned.
See: Convert.ToString Method (String)
Returns the specified string instance; no actual conversion is performed.
This is how it is implemented
public static String ToString(String value) {
Contract.Ensures(Contract.Result<string>() == value); // We were always skipping the null check here.
return value;
}
Just to add one more thing, System.Convert
has methods to covert each type to itself like Convert.ToInt32 Method (Int32) and in all cases these methods do nothing, the actual value is returned.
Upvotes: 11