I am having a little problems getting String's StartsWith and
EndsWith methods. If I have a string defined as
sNormalPt which equals "0x11D0" then use the following command
sNormalPt.StartsWith( "0x" )
the application throws and exception stating
error: 'sNormalPt.StartsWith' does not exist
I get the same behavior using the EndsWith method also. The following
is the output from the command window as I typed commands
sNormalPt
"0x11D0"
sNormalPt.Length
6
sNormalPt.StartsWith( "0x" )
error: 'sNormalPt.StartsWith' does not exist
sNormalPt.EndsWith( "D0" )
error: 'sNormalPt.EndsWith' does not exist
I don't understand why this is failing, does any one have some clues?
I do have Visual C# Express Beta 2 installed, so perhaps that has
something to do with it????
Mark
Hello again,
I found out that that most of the string methods are not working.
Here are a few that I tried and they failed providing me with the same
error message.
ToUpper()
ToLower()
SubString()
I also added a config file in case the .NET 2.0 was causing problems
which looks like
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<requiredRuntime version="V1.1.4322" />
</startup>
</configuration>
With this even in the debug folder it doesn't help....
Mark
The methods (EndsWith, StartsWith) all work correctly in code, just not
in the command window when using C#. It also does *not* work for me in
the watch windows
It *does* work correctly when using VB.Net in both cases. I'm not sure
why C# doesn't allow that type of evaluation in the command window or
watch windows. That would seem to be a severe limitation to debugging.
Since I debugging the application I hadn't tried running the
application normally, but after reading your post I let it run normally
and the string methods do function correctly. As you already stated
this does limit debugging fairly severely. Was this topic talked about
before? I didn't see anything and should this item be submitted to
Microsoft? If so, how would one submit this?
Mark
In the test code I wrote:
string testString = "blah blah blah blah";
using the command window after hitting the break:
(testString[0] == 'b')
true
A lot of the functions that retrieve data or operate based on a strings
underlying char[] type do not operate propperly in the debug mode
command window.
No, string and char[] are fairly different. While string does contain a
sequence of chars, it isn't really an array.
> It may be possible that in C# debug mode it makes that distinction,
> while in VB debug mode, it does not. So while intellisense shows the
> methods as being available, they actually are not.
>
> In the test code I wrote:
>
> string testString = "blah blah blah blah";
>
> using the command window after hitting the break:
>
> (testString[0] == 'b')
> true
>
> A lot of the functions that retrieve data or operate based on a strings
> underlying char[] type do not operate propperly in the debug mode
> command window.
There *is* no underlying char[] type. The above uses the *indexer* of a
string, which doesn't mean it's actually an array.
--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too