-
March 16th, 2007, 01:27 AM
#1
[RESOLVED] How to convert integer to string in C#
Hello all.
I am developing a code in which I need to convert int to string. Plz help...
-
March 16th, 2007, 01:58 AM
#2
Re: How to convert integer to string in C#
Hi,
Like this:
Code:
String number;
int x = 10;
number = x.ToString();
Regards,
Laitinen
-
March 16th, 2007, 02:02 AM
#3
Re: How to convert integer to string in C#
Or
Code:
int x = 10;
string xstring = Convert.ToString(x);
MessageBox.Show(xstring);
VS 2005
-
March 16th, 2007, 02:08 AM
#4
Re: How to convert integer to string in C#
This is the code...
asset_file_list += "\n<asset size=" + asset_file_size + " count=" + asset_file_count + ">\n";
here i want that "asset_file_list" variable should get the value like
<asset size="517361" count="11">
but its giving...
<asset size=517361 count=11>
Plz check and give support...
-
March 16th, 2007, 02:14 AM
#5
Re: How to convert integer to string in C#
Code:
asset_file_list += "\n<asset size=" + asset_file_size.ToString() + " count=" + asset_file_count.ToString() + ">\n";
-
March 16th, 2007, 02:17 AM
#6
Re: How to convert integer to string in C#
This is not working...Giving the same output as above mensioned. I tried this earlier...
-
March 16th, 2007, 02:39 AM
#7
Re: How to convert integer to string in C#
Do you really want the output to look like this:
<asset size="517361" count="11">
assuming that asset_file_size and asset_file_count is already a string,
Code:
asset_file_list += "\n<asset size=" + "\"" + asset_file_size + "\"" + " count=" + "\""+ asset_file_count + "\"" + ">\n";
otherwise do this:
Code:
asset_file_list += "\n<asset size=" + "\"" + asset_file_size.ToString() + "\"" + " count=" + "\""+ asset_file_count.ToString() + "\"" + ">\n";
-
March 24th, 2014, 02:42 AM
#8
Re: [RESOLVED] How to convert integer to string in C#
For anyone who's curious about the fastest way to convert an int to a string, you can read this webpage (http://cc.davelozinski.com/c-sharp/f...-int-to-string).
Basically it's a toss up between:
.ToString()
Convert.ToString()
until you get to about 21 million conversions.
The code is there too if you want to run it on your own system.
Good luck!
Last edited by FireMyst; July 5th, 2014 at 07:27 AM.
Reason: Updated link since it was out of date.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|