开发者

Problems converting VB.NET to C#

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 ex开发者_StackOverflow社区ist 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).


The Strings utility class is in the Microsoft.VisualBasic namespace.

You can add a reference to the library and use it from your C# code, or rewrite the calls:

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


In c# there is no Strings class in System namespace. and in the string change LCase to ToLower, So:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜