|
-
Nov 26th, 2003, 08:33 AM
#1
Translating C++.Net code to C# - {RESOLVED}
I've seen the light, I've given up C++.net and as a result, I've got a large chunk of code to trawl through to move over to C#.
One thing though, In C++ I used this to test whether a pointer had been initialised...
Code:
if(!pMyString)
//it hasn't been initialised yet
else
//it has
In C# I have changed the pointer into to a string variable.
Now if I have:
Code:
string MyString;
//...
what is it's state now, it is null, nothing, empty, "" or what?
And how do I test it.
Thanks.
PS, why didn't anyone tell me that Managed C++ was so arse?
Last edited by wossname; Nov 27th, 2003 at 03:58 AM.
I don't live here any more.
-
Nov 26th, 2003, 10:58 AM
#2
PowerPoster
Not one hundred percent:
mystring != null
-
Nov 26th, 2003, 03:50 PM
#3
when initially creating the string, try this...
VB Code:
[Color=Blue]string[/color] MyString = [Color=Blue]string[/color].Empty;
then you can check if the string is empty or not like this....
VB Code:
[Color=Blue]private[/color] [Color=Blue]void[/color] button1_Click([Color=Blue]object[/color] sender, System.EventArgs e)
{
[Color=Blue]string[/color] MyString = [Color=Blue]string[/color].Empty;
[Color=Blue]if[/color](MyString==[Color=Blue]string[/color].Empty)
{
MessageBox.Show("it's empty");
}
[Color=Blue]else
[/color] {
MessageBox.Show("it's NOT empty");
}
}
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Nov 27th, 2003, 03:57 AM
#4
-
Nov 29th, 2003, 08:49 AM
#5
yay gay
Originally posted by hellswraith
Not one hundred percent:
mystring != null
i do believe it is null if you dont assign nothing to it, wouldnt it be if it was with any other object type?
\m/  \m/
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
|