implementing interfaces during VB to VB.NET class migration
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 ES开发者_C百科RI.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.
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.
精彩评论