About the Find near features SOAP SOE Sample
[C#]
CustomLayerInfo_VBNet.cs
[Visual Basic .NET]
CustomLayerInfo_VBNet.vb
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Runtime.InteropServices
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.SOESupport
Namespace FindNearFeaturesSoapSOE_VBNet
<ComVisible(True), Guid("A47E2E54-56FA-4C92-8B7C-B3B9473C9240"), ClassInterface(ClassInterfaceType.None)> _
Public Class CustomLayerInfo_VBNet
Implements IXMLSerialize
Private privateName As String
Public Property Name() As String
Get
Return privateName
End Get
Set(ByVal value As String)
privateName = value
End Set
End Property
Private privateID As Integer
Public Property ID() As Integer
Get
Return privateID
End Get
Set(ByVal value As Integer)
privateID = value
End Set
End Property
Private privateExtent As IEnvelope
Public Property Extent() As IEnvelope
Get
Return privateExtent
End Get
Set(ByVal value As IEnvelope)
privateExtent = value
End Set
End Property
#Region "IXMLSerialize Members"
Public Sub Serialize(ByVal data As IXMLSerializeData) Implements IXMLSerialize.Serialize
data.TypeName = Me.GetType().Name
data.TypeNamespaceURI = FindNearFeaturesSoapSOE_VBNet.c_ns_soe
data.AddString("Name", Name)
data.AddInteger("ID", ID)
data.AddObject("Extent", Extent)
End Sub
Public Sub Deserialize(ByVal data As IXMLSerializeData) Implements IXMLSerialize.Deserialize
Dim idx As Integer = FindMandatoryParam("Name", data)
Me.Name = data.GetString(idx)
idx = FindMandatoryParam("ID", data)
Me.ID = data.GetInteger(idx)
idx = FindMandatoryParam("Extent", data)
Me.Extent = CType(data.GetObject(idx, FindNearFeaturesSoapSOE_VBNet.c_ns_esri, "Envelope"), IEnvelope)
End Sub
#End Region
Private Function FindMandatoryParam(ByVal fieldName As String, ByVal data As IXMLSerializeData) As Integer
Dim idx As Integer = data.Find(fieldName)
If idx = -1 Then
Throw New MissingMandatoryFieldException(fieldName)
End If
Return idx
End Function
Friend Class MissingMandatoryFieldException
Inherits Exception
Friend Sub New(ByVal fieldName As String)
MyBase.New("Missing mandatory field: " & fieldName)
End Sub
End Class
End Class 'class CustomLayerInfo
<ComVisible(True), Guid("0003D147-00B0-4C3C-AB64-7E684765F14E"), ClassInterface(ClassInterfaceType.None)> _
Public Class CustomLayerInfos_VBNet
Inherits SerializableList(Of CustomLayerInfo_VBNet)
Public Sub New(ByVal namespaceURI As String)
MyBase.New(namespaceURI)
End Sub
End Class 'class CustomLayerInfos
End Namespace