使用Telerik's在线转换器将c#转换为VB

本文关键字:转换 VB 转换器 在线 Telerik 使用 | 更新日期: 2023-09-27 18:12:59

我有一大堆c#类,我需要转换成VB,但我不明白一些C是关于什么的。

这是一个典型的c#类——
using System;
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(IsWrapped = false)]
public partial class CreateServiceToken_1_RequestMessage
{
    [System.ServiceModel.MessageHeaderAttribute(Namespace = "http://www.reuters.com/ns/2008/03/01/webservices/rkd/Cache_1")]
    public ThomsonReutersKnowledgeDirect.CacheRequest CacheRequest;
    [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1", Order = 0)]
    public ThomsonReutersKnowledgeDirect.CreateServiceToken_Request_1 CreateServiceToken_Request_1;
    public CreateServiceToken_1_RequestMessage()
    {
    }
    public CreateServiceToken_1_RequestMessage(ThomsonReutersKnowledgeDirect.CacheRequest CacheRequest, ThomsonReutersKnowledgeDirect.CreateServiceToken_Request_1 CreateServiceToken_Request_1)
    {
        this.CacheRequest = CacheRequest;
        this.CreateServiceToken_Request_1 = CreateServiceToken_Request_1;
    }
}

Telerik的在线转换器在VB中给了我这个:

<System.Diagnostics.DebuggerStepThroughAttribute()> _
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")> _
<System.ServiceModel.MessageContractAttribute(IsWrapped:=False)> _
Partial Public Class CreateServiceToken_1_RequestMessage
    <System.ServiceModel.MessageHeaderAttribute([Namespace]:="http://www.reuters.com/ns/2008/03/01/webservices/rkd/Cache_1")> _
    Public CacheRequest As ThomsonReutersKnowledgeDirect.CacheRequest
    <System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1", Order:=0)> _
    Public CreateServiceToken_Request_1 As ThomsonReutersKnowledgeDirect.CreateServiceToken_Request_1
    Public Sub New()
    End Sub
    Public Sub New(CacheRequest As ThomsonReutersKnowledgeDirect.CacheRequest, CreateServiceToken_Request_1 As ThomsonReutersKnowledgeDirect.CreateServiceToken_Request_1)
        Me.CacheRequest = CacheRequest
        Me.CreateServiceToken_Request_1 = CreateServiceToken_Request_1
    End Sub
End Class

问题是这会产生各种各样的错误,例如'System. 'ServiceModel'没有定义。
是<>封闭的东西需要VB或只是从c#遗留下来的?

BTW我使用VS 2010

使用Telerik's在线转换器将c#转换为VB

'stuff in <>'是需要的,它们是属性。

在不知道更多的情况下,我想说你的错误是由于缺少导入'using。

看看c#文件的顶部,有许多using something.something语句。在VB文件中应该有相应的Imports something.something