2011-08-04 6 views
1

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(); 

誰でも知っていますか?

は、私は、次の名前空間が設定されている:私は、Webサービス(ASMXファイル)に取り組んでいます

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; 

答えて

7

StringsユーティリティクラスはMicrosoft.VisualBasic名前空間にあります。

あなたはライブラリへの参照を追加し、C#コードからそれを使用する、または通話を書き換えることができます。

strUser = strUserInitials[strUserInitials.GetUpperBound(0)].ToString().Trim().ToLower(); 
3

C#ではSystem名前空間にStringsクラスがありません。そしてToLowerからstring変更LCaseに:だから、

strUser = string.ToLower(string.Trim(strUserInitials[strUserInitials.GetUpperBound(0)])); 
関連する問題