Strings

String Representation in C#

Used to return a string representation of a non-string (convert non-string to string).


Syntax
///using static method
string newString = Convert.ToString(nonString);
///called on variable directly, if type allows it
string newString2 = nonString2.toString();

Notes

Variables declared using primitive data types all have the ToString method.


Example
int number = 25;
///will assign "25" to numberAsString
string numberAsString = Convert.ToString(number);

See Also
Documentation

Convert.ToString Method - MSDN

Add to Slack

< String Split   |   Commenting >

© 2019 SyntaxDB. All Rights Reserved.