C#中visual basic的system.object类的替代方案是什么? [英] What will be the alternative of system.object class from visual basic in C#?

查看:129
本文介绍了C#中visual basic的system.object类的替代方案是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我有一个用Visual Basic编写的代码,我现在用C#编写相同的代码。



Visual Basic中的代码如下:



< pre> Dim Width1500  As  字符串 = fPath +   \err \Width1500 \& i1.value 





当我尝试在C#中编写相同内容时,它向我显示错误。我写的代码是:



  string  Width1500 = fPath.ToString ()+   \\\\\\Width1500 \\ + i1。  value ; 





我得到的错误是:

错误CS1061:'object'不包含'value'的定义,并且没有扩展方法'value'可以找到'object'类型的第一个参数(你是否错过了使用指令或汇编参考?)



请帮忙。



问候

Aman Chaurasia



我尝试过:



 string Width1500 = fPath.ToString()+\\\\\Width1500 \\+ i1.value; 

,但它无法帮助。

解决方案

你必须将对象转换为prope r型拳头(对象类型为i1)



尝试

(i1为'i1_object_type')。value 


Hello,

I have a code written in Visual Basic and I am writing the same in C# now.

The code in Visual Basic is as follows:

<pre>Dim Width1500 As String = fPath + "\err\Width1500\" & i1.value



When I tried to write the same in C#, it showed me an error. The code I wrote is:

string Width1500 = fPath.ToString() + "\\err\\Width1500\\" + i1.value;



The error I am getting is:
Error CS1061: 'object' does not contain a definition for 'value' and no extension method 'value' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

Please help.

Regards
Aman Chaurasia

What I have tried:

string Width1500 = fPath.ToString() + "\\err\\Width1500\\" + i1.value;

, but it won't help.

解决方案

you have to cast the object to proper type fist(to the object type of i1)

try

(i1 as 'i1_object_type').value


这篇关于C#中visual basic的system.object类的替代方案是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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