I have string value and Type
of some variable (For example int
and "32"
or bool
and true
). My type is primitive type. Can I parse string to my type in one line?
Yes.
Convert.ChangeType(value, type);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With