拆分字符串在 MVC 控制器中不起作用 [英] Split string is not working in MVC controller

查看:30
本文介绍了拆分字符串在 MVC 控制器中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 MVC 控制器中有以下代码:

I have the following code in my MVC controller:

string[] w_result;
string[] w_result2;

string[] new_line = { Environment.NewLine };
string all_copybook = c.original_copybook;

w_result = all_copybook.Split(new_line, StringSplitOptions.RemoveEmptyEntries);
w_result2 = "abaUUUnns s s".Split('a'); 

当我通过调试器在 Visual Studio 2012 中运行它时,我没有发现任何异常,但是当我尝试查看 w_resultw_result2 的值时,我得到:

When I run it in Visual Studio 2012 through the debugger I see no exception, but when I try to view the value of w_result or w_result2, I am getting:

w_result 当前上下文中不存在名称w_result"
w_result2 当前上下文中不存在名称 'w_result2'

w_result The name 'w_result' does not exist in the current context
w_result2 The name 'w_result2' does not exist in the current context

知道为什么吗?

推荐答案

对于调试,请将构建配置更改为 Debug 而不是 Release.Release 配置可以优化您的代码并防止调试器看到一些局部变量.

For debugging, change your build configuration to Debug instead of Release. The Release configuration can optimize your code and prevent the debugger from seeing some local variables.

这篇关于拆分字符串在 MVC 控制器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆