|
-
May 18th, 2006, 09:30 PM
#1
Thread Starter
Lively Member
[1.0/1.1] Converting Integer to String in C#
hi all,
i know this is really simple. but i still get it wrong. i try to do this:
int intLen = 100;
string StrLen;
StrLen = intLen;
MessageBox StrLen;
i got error. Y?
longwar
-
May 18th, 2006, 09:47 PM
#2
Re: [1.0/1.1] Converting Integer to String in C#
Every object has a ToString method:
Code:
myString = anyObject.ToString();
-
May 18th, 2006, 09:51 PM
#3
Thread Starter
Lively Member
Re: [1.0/1.1] Converting Integer to String in C#
ic ... i got it. tot it is the same as in VB
-
May 18th, 2006, 10:18 PM
#4
Re: [1.0/1.1] Converting Integer to String in C#
It's exactly the same as VB. Same framework. Just different syntax.
If your problem is fixed please go to Thread Tools (above the first post) and click Mark Thread Resolved. Thanks
-
May 18th, 2006, 10:20 PM
#5
Re: [1.0/1.1] Converting Integer to String in C#
When you're dealing with types from the .NET Framework it's always going to be essentially the same regardless of language. The only difference is the syntax of the langauge, like in C# you need the semicolon obviously, and in C# if you're indexing a property you use square brackets instead of parentheses. Just little stuff like that. all the types and members are exactly the same though.
-
May 19th, 2006, 07:29 AM
#6
Fanatic Member
Re: [1.0/1.1] Converting Integer to String in C#
Won't using ToString on an Integer just return its memory address?
-
May 19th, 2006, 07:31 AM
#7
Re: [1.0/1.1] Converting Integer to String in C#
Why don't you try it and see.
-
May 19th, 2006, 08:40 AM
#8
Re: [1.0/1.1] Converting Integer to String in C#
Why would converting anything to a string return a memory address? C# doesn't expose memory addresses at all except through unsafe code, and then it is with pointers. The whole point of reference types is to hide memory addresses and pointers from the developer.
-
May 19th, 2006, 08:50 AM
#9
Fanatic Member
Re: [1.0/1.1] Converting Integer to String in C#
 Originally Posted by jmcilhinney
Why would converting anything to a string return a memory address? C# doesn't expose memory addresses at all except through unsafe code, and then it is with pointers. The whole point of reference types is to hide memory addresses and pointers from the developer.
Ah, thanks for the info
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
|