Hey,
I have a variable id that is assigned to an int? in my constructor. However later on I require a string to be displayed in a grid.....
How can i convert from int? to string ? The Convert.ToString( id ); - doesnt work. Any ideas....all other forums so far have shown me this solution.
Thanks in advance.
N Daen G.
Loading
Kumar AGPosted Jul 15, 2009, 3:51 PM
string id3 = id.Value.ToString();
Or
string id3 = Convert.ToString(id.Value);
JayPosted Jul 18, 2009, 2:25 PM
Object int is Integer. where primitive int is just a int. I'm sure you know that already.
And i'm positive that you can just simply do:
Convert.ToString(yournumber);
so i reckon 1 line would do, as i've just tried it out.
personPosted Jul 15, 2009, 12:26 PM
E.g.
int? id = 0;
int id2 = (int)id;
string id3 = id2.ToString();
Cheers anyway and if there is a better solution please let me know.
N Dean G.