在 VB 到 VB.NET 类迁移期间实现接口
我正在迁移 CenterSnap.cls 从其 vb 版本到 vb.NET 以及将 vb6 项目导入 VS 2008 后,我对以下 2 个错误感到困惑。
Err 1
Imports System.Runtime.InteropServices
Imports ESRI.ArcGIS.esriSystem
<System.Runtime.InteropServices.ProgId("StackMap.CenterSnap")>
Public Class CenterSnap
Implements ESRI.ArcGIS.Editor.ISnapAgent
Implements ESRI.ArcGIS.esriSystem.IPersistVariant ' <<<<ERROR 1
错误 1 类“CenterSnap”必须为接口“ESRI.ArcGIS.esriSystem.IPersistVariant”实现“只读属性 ID 作为 UID”。实现属性必须具有匹配的“ReadOnly”或“WriteOnly”说明符。 C:\Projects\VB_ActiveX_dll\StackMap\StackMap\CenterSnap.vb 9 16 StackMap
错误 2
Private ReadOnly Property IPersistVariant_ID() As ESRI.ArcGIS.esriSystem.IUID _
Implements ESRI.ArcGIS.esriSystem.IPersistVariant.ID '<<<< ERROR 2
错误 2“IPersistVariant_ID”无法实现“ID”,因为接口“ESRI.ArcGIS.esriSystem.IPersistVariant”上没有匹配的属性。 C:\Projects\VB_ActiveX_dll\StackMap\StackMap\CenterSnap.vb 16 94 StackMap
Get
Dim pID As New ESRI.ArcGIS.esriSystem.UID
pID.Value = "CenterSnap.clsCenterSnap"
IPersistVariant_ID = pID
End Get
为什么 Implements ESRI.ArcGIS.esriSystem.IPersistVariant
没有实现?我在项目中引用了 ESRI.esriSystem。
I'm migrating the CenterSnap.cls from its vb version to vb.NET and I'm confused about the following 2 errors after I import the vb6 project to VS 2008.
Err 1
Imports System.Runtime.InteropServices
Imports ESRI.ArcGIS.esriSystem
<System.Runtime.InteropServices.ProgId("StackMap.CenterSnap")>
Public Class CenterSnap
Implements ESRI.ArcGIS.Editor.ISnapAgent
Implements ESRI.ArcGIS.esriSystem.IPersistVariant ' <<<<ERROR 1
Error 1 Class 'CenterSnap' must implement 'ReadOnly Property ID As UID' for interface 'ESRI.ArcGIS.esriSystem.IPersistVariant'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers. C:\Projects\VB_ActiveX_dll\StackMap\StackMap\CenterSnap.vb 9 16 StackMap
Err 2
Private ReadOnly Property IPersistVariant_ID() As ESRI.ArcGIS.esriSystem.IUID _
Implements ESRI.ArcGIS.esriSystem.IPersistVariant.ID '<<<< ERROR 2
Error 2 'IPersistVariant_ID' cannot implement 'ID' because there is no matching property on interface 'ESRI.ArcGIS.esriSystem.IPersistVariant'. C:\Projects\VB_ActiveX_dll\StackMap\StackMap\CenterSnap.vb 16 94 StackMap
Get
Dim pID As New ESRI.ArcGIS.esriSystem.UID
pID.Value = "CenterSnap.clsCenterSnap"
IPersistVariant_ID = pID
End Get
Why is the Implements ESRI.ArcGIS.esriSystem.IPersistVariant
not implementing? I have the ESRI.esriSystem referenced in the project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从代码的外观来看,错误表明它需要 UID 属性,但您的 IPersistVeriant_ID 属性返回 IUID。
我不熟悉 ESRI.ArcGIS 是什么,但看起来 UID 和 IUID 不是同一件事。
From the looks of the code, the error says it is expecting an UID property, but your IPersistVeriant_ID property is returning an IUID.
I'm not familiar with what an ESRI.ArcGIS thing is, but it looks like UID and IUID are not the same thing.