我需要将一大堆VC类转换为VB,但我不明白其中的一些是什么。
这是一个典型的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' 是&lt;&gt; VB所需的封装内容或刚从C#中删除?
BTW我正在使用VS 2010
答案 0 :(得分:1)
&lt;&gt;&#39;中的&#39;需要,它们是attributes。
我不知道更多,我会说你的错误是由于缺少进口\使用。
查看C#文件的顶部,有许多using something.something
语句。这些应该在VB文件中具有相应的Imports something.something
。