C#.net中的声明显示错误 [英] declaration in C# .net it shows an error

查看:70
本文介绍了C#.net中的声明显示错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在转换它时,它显示一个错误(这是VB.net)


while converting this, it shows an error (this is VB.net)


// i need in c#
int dotvalue = Strings.InStr(this.Text, ".");
string x = Strings.Left(Strings.Trim(this.Text), 1);

推荐答案

您拥有的不是VB.NET.除非这是一个自定义类,否则没有类型为Strings的对象.也没有名为InStr
的方法
What you have is not VB.NET. There is no object of type Strings unless this is a custom class. Nor is there a method named InStr

int dotvalue = string.Compare(Text, ".");



尝试自己查找其余部分.



Try looking up the rest on your own.


即使凝视了我的水晶球,我也不得不猜测你在说什么,因为你没说清楚错误是什么.

我的主意是Stringsthis.Text(或两者)都为空.

此外,您尝试通过使用字符串作为开始的索引来获取子字符串.我认为您打算改用dotvalue.

也许您应该尝试在调试器下运行代码.
Even after gazing into my crystal ball, I have to guess at what the hell you''re talking about because you didn''t say EXACTLY WHAT the error was.

My GUESS is that either Strings or this.Text (or both) are empty.

Further, you''re trying to get a substring by using a string as the index to start at. I think you meant to use dotvalue instead.

Perhaps you should try running your code under the debugger.


这篇关于C#.net中的声明显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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