Answer:
>>> The Convert class is used to convert any value from any data type to another data type. This class consist of different methods for making conversions.
Example:
1) char ch = Convert.ToChar("x"); -> string to character
2) float f = Convert.ToSingle(45); -> int to float
3) int x = Convert.ToInt(4.5f); -> float to int
>>> The Parse method is used to convert only one string value to any other data type. Every data type is consisting of parse() method.
Example:
1) int x = int.Parse("600"); -> string to int
2) char ch = char.Parse("dnf"); -> string to character
Asked In: Many Interviews |
Alert Moderator