[英]String type check variable not saving actual string
here are 2 screen shots when i try to debug my code in visual studio 2005 这是当我尝试在Visual Studio 2005中调试代码时的2个屏幕截图
i want to save string value in variable check
in variable a
but it saves -1
not the actual string which is something like that "<username>admin</username>"
我想保存在变量字符串值
check
变量a
也可节省-1
不是实际的字符串,它是类似的东西, "<username>admin</username>"
If you want to save the value of check
in a
, then your assignment is the wrong way round. 如果你想保存的值
check
的a
,那么你的任务是南辕北辙。 Currently it's converting the value of a
to a string, and storing the result in check
. 目前,它将
a
的值转换为字符串,并将结果存储在check
。
Of course, you haven't specified the type of a
- it may be converted to a string one way in the debugger, but the actual ToString
method may be overridden to do something different. 当然,你还没有指定的类型
a
-它可以被转换成在调试器字符串的一种方式,但实际ToString
方法可能会被改写做不同的事情。
If you actually meant to describe the question the other way round, you need to provide a lot more information - a short but complete program to demonstrate the problem would be ideal. 如果你其实是要倒过来描述的问题,您需要提供更多的信息-一个简短而完整的程序来演示该问题将是理想的。
String assignment very definitely works in C# - so the chances are incredibly high that you're doing something strange in the code that you haven't shown us. 字符串赋值在C#中绝对可以正常工作-因此,您在未显示给我们的代码中做奇怪的事情的可能性非常高。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.