我正在尝试将一些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;我正在做一个网络服务(asmx文件)。
发布于 2011-08-04 19:27:59
Strings实用程序类位于Microsoft.VisualBasic命名空间中。
您可以添加对该库的引用,并在C#代码中使用它,或者重写调用:
strUser = strUserInitials[strUserInitials.GetUpperBound(0)].ToString().Trim().ToLower();发布于 2011-08-04 19:27:29
在c#中,System命名空间中没有Strings类。在string中,将LCase更改为ToLower,因此:
strUser = string.ToLower(string.Trim(strUserInitials[strUserInitials.GetUpperBound(0)]));https://stackoverflow.com/questions/6940535
复制相似问题