将 VB.NET 转换为 C# 时出现问题
我正在尝试将一些 vb.net 转换为 C#,但我不断收到错误。目前,我收到以下错误:
The name 'Strings' does not exist in the current context
问题是:
strUser = Strings.LCase(Strings.Trim(strUserInitials[strUserInitials.GetUpperBound(0)])).ToString();
有人知道为什么会发生这种情况吗?
我设置了以下命名空间:
using System;
using System.Web;
using System.Web.Services;
using System.Web.Script;
using System.Web.Script.Services;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
我正在开发一个 Web 服务(asmx 文件)。
I am trying to convert some vb.net to C#, but I keep getting errors. At the moment, I am getting the following error:
The name 'Strings' does not exist in the current context
The problem line is:
strUser = Strings.LCase(Strings.Trim(strUserInitials[strUserInitials.GetUpperBound(0)])).ToString();
Anyone know why this is happening?
I have the following namespaces set:
using System;
using System.Web;
using System.Web.Services;
using System.Web.Script;
using System.Web.Script.Services;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
I am working on a webservice (asmx file).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Strings
实用程序类位于 Microsoft.VisualBasic 命名空间中。您可以添加对该库的引用并从 C# 代码中使用它,或者重写调用:
The
Strings
utility class is in theMicrosoft.VisualBasic
namespace.You can add a reference to the library and use it from your C# code, or rewrite the calls:
在 C# 中,
System
命名空间中没有Strings
类。并在string
中将LCase
更改为ToLower
,所以:In c# there is no
Strings
class inSystem
namespace. and in thestring
changeLCase
toToLower
, So: