如何将 CharArrayType 从 Visual Basic 转换为 C#
我正在将用 Visual Basic 编写的旧程序更新为 C#。我似乎无法在 C# 中找到与 Visual Basic 类“CharArrayType”等效的类。有谁知道这个类在 C# 中是否有等效的类?
return (char[])CharArrayType
.FromObject(LateBinding
.LateIndexGet(array, new object[] { 0 }, null));
I am updating an old program made in Visual Basic to C#. I can't seem to find an equivalent to the visual Basic class 'CharArrayType' in C#. Does anyone know if this class even has an equivalent in C#?
return (char[])CharArrayType
.FromObject(LateBinding
.LateIndexGet(array, new object[] { 0 }, null));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
CharArrayType
在 Visual Basic 2005 中已被弃用。这更多的是 API 中弃用功能的问题,而不是 VB 与 C# 语法的问题。
以下是它支持的方法:
如需更多帮助,请回答以下问题:
CharArrayType
类中的哪些方法?另外,发布一些代码可能会有所帮助。
CharArrayType
was deprecated in Visual Basic 2005.This is more an an issue of a deprecated feature in the API than VB versus C# syntax.
Here are the methods it supports:
For more help, please answer these questions:
CharArrayType
class were you using in your old Visual Basic program?Also, posting some code may help.
我认为您可以像这样使用
char
数组:但是在 dot.net 中没有完全等效的数组。
用于实现
FromString
你可以这样做:其他功能是基于对象的。另请注意,
char[]
也包含此功能。I think you can use an array of
char
like this:however there isn't an exact equivalent for this in dot.net.
For implementing functionality like
FromString
you can do something like this:Other functionality is based on object. Note as well that
char[]
includes this feature as well.根据 此 MSDN 文档(追溯到 .NET 2.0):
所以我怀疑目前没有同等的东西。你用这个类的目的是什么?正如 @Yuck 所要求的,请向我们展示代码。
According to this MSDN doc (going back as far as .NET 2.0):
So I suspect there is no current equivalent. For what are you using this class? As @Yuck asked, please show us the code.