e.g
int a=10;
string b="abc"
a = a+ b;
is it possible???
how???
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Mar 18, 2013, 12:48 PM
However, if you specify that the string represents a hexadecimal number, then it will work as the code is equivalent to what I posted in the first place:
arslan elahiPosted Mar 18, 2013, 7:55 AM
int a=10;
object b="abc";
a=a+ Convert.ToInt32(b.toString());
it is working
VulpesPosted Mar 18, 2013, 7:19 AM
compiles OK with Option Strict Off but produces a run time exception because "abc" can't be parsed to a double.
arslan elahiPosted Mar 18, 2013, 7:11 AM
i want to convert it in C#
VulpesPosted Mar 18, 2013, 7:08 AM
However, the following does work:
The result is 2758.
The reason this works is because "abc" can be parsed to an hexadecimal integer which is equivalent to 2748 decimal. So adding 10 gives a result of 2758.