how to deserealizate manually - serialization

i have this strings
{\"Data\":null,\"ErrorCode\":0,\"IsSuccess\":false,\"Message\":\"No hay informacion para descargar\",\"SuccessCode\":100}
{\"Data\":{\"BranchCodes\":[\"30\"],\"ProcessId\":86},\"ErrorCode\":0,\"IsSuccess\":true,\"Message\":null,\"SuccessCode\":0}
{\"Data\":{\"BranchCodes\":[\"30\",\"97\"],\"ProcessId\":87},\"ErrorCode\":0,\"IsSuccess\":true,\"Message\":null,\"SuccessCode\":0}
i want to convert to this object
Class WorkGroupMetric
Public Property Data() As Data
Get
Return m_Data
End Get
Set(ByVal value As Data)
m_Data = Value
End Set
End Property
Private m_Data As Data
Public Property ErrorCode() As Integer
Get
Return m_ErrorCode
End Get
Set(ByVal value As Integer)
m_ErrorCode = Value
End Set
End Property
Private m_ErrorCode As Integer
Public Property IsSuccess() As Boolean
Get
Return m_IsSuccess
End Get
Set(ByVal value As Boolean)
m_IsSuccess = Value
End Set
End Property
Private m_IsSuccess As Boolean
Public Property Message() As String
Get
Return m_Message
End Get
Set(ByVal value As String)
m_Message = Value
End Set
End Property
Private m_Message As String
Public Property SuccessCode() As Integer
Get
Return m_SuccessCode
End Get
Set(ByVal value As Integer)
m_SuccessCode = Value
End Set
End Property
Private m_SuccessCode As Integer
End Class
Public Class Data
Public Property BranchCodes() As List(Of String)
Get
Return m_BranchCodes
End Get
Set(ByVal value As List(Of String))
m_BranchCodes = value
End Set
End Property
Private m_BranchCodes As List(Of String)
Public Property ProcessId() As Integer
Get
Return m_ProcessId
End Get
Set(ByVal value As Integer)
m_ProcessId = Value
End Set
End Property
Private m_ProcessId As Integer
End Class
i need help i am doing this in visual studio 2005, with scriptask for ssis.
i cant uses JavaScriptSerializer or similar, this must to be manually.

You really want to avoid doing this manually, I would investigate json.net, which is not part of the .net framework and should work with vs2005. http://james.newtonking.com/json

Related

How to use the following model class (Framework 4.7) in a Framework 2.0?

I have the following model class used in my .NET Framework 4.7.2 project which get and set data from an API.
I have to use the same model class in a .NET 2.0 Project which will have to get and set the same object get from a HTTP request (not API)
But if i try just to copy paste it i get the error which says that i need a setter on it.
Here is how my model looks like:
Public Class PDT
Public Class Documento
Public Property testata As Testata
Public Property corpo() As IEnumerable(Of Corpo)
End Class
Public Class Testata
Public Property id As Integer
Public Property cod As String
Public Property tipo As String
Public Property cod_fornitore As String
Public Property desc_fornitore As String
Public Property data As String
Public Property num_pv As String
Public Property desc_pv As String
Public Property num_pv_destinazione As String
Public Property desc_pv_destinazione As String
Public Property num_ordine As String
Public Property inviato As Boolean
End Class
Public Class Corpo
Public Property barcode As String
Public Property desc As String
Public Property um As String
Public Property qta As Single
Public Property id_testata As Integer
Public Property tipo_frontalino As String
Public Property timestamp As Long
End Class
End Class
PS I've tried setting getter and setters like this for each property:
Public Property testata() As Testata
Get
End Get
Set(ByVal value As Testata)
End Set
End Property
But by passing data in that object returns always Nothing.
UPDATE my class with getters and setters:
Public Class PDT
Public Class Documento
Private _testata As Testata = Nothing
Public Property testata As Testata
Get
Return _testata
End Get
Set(ByVal value As Testata)
_testata = value
End Set
End Property
Private _corpo As IEnumerable(Of Corpo) = Nothing
Public Property corpo As IEnumerable(Of Corpo)
Get
Return _corpo
End Get
Set(ByVal value As IEnumerable(Of Corpo))
_corpo = value
End Set
End Property
End Class
Public Class Testata
Private _id As Integer = Nothing
Public Property id As Integer
Get
Return _id
End Get
Set(ByVal value As Integer)
_id = value
End Set
End Property
Private _cod As String = Nothing
Public Property cod As String
Get
Return _cod
End Get
Set(ByVal value As String)
_cod = value
End Set
End Property
Private _tipo As String = Nothing
Public Property tipo As String
Get
Return _tipo
End Get
Set(ByVal value As String)
_tipo = value
End Set
End Property
Private _cod_fornitore As String = Nothing
Public Property cod_fornitore As String
Get
Return _cod_fornitore
End Get
Set(ByVal value As String)
_cod_fornitore = value
End Set
End Property
Private _desc_fornitore As String = Nothing
Public Property desc_fornitore As String
Get
Return _desc_fornitore
End Get
Set(ByVal value As String)
_desc_fornitore = value
End Set
End Property
Private _data As String = Nothing
Public Property data As String
Get
Return _data
End Get
Set(ByVal value As String)
_data = value
End Set
End Property
Private _num_pv As String = Nothing
Public Property num_pv As String
Get
Return _num_pv
End Get
Set(ByVal value As String)
_num_pv = value
End Set
End Property
Private _desc_pv As String = Nothing
Public Property desc_pv As String
Get
Return _desc_pv
End Get
Set(ByVal value As String)
_desc_pv = value
End Set
End Property
Private _num_pv_destinazione As String = Nothing
Public Property num_pv_destinazione As String
Get
Return _num_pv_destinazione
End Get
Set(ByVal value As String)
_num_pv_destinazione = value
End Set
End Property
Private _desc_pv_destinazione As String = Nothing
Public Property desc_pv_destinazione As String
Get
Return _desc_pv_destinazione
End Get
Set(ByVal value As String)
_desc_pv_destinazione = value
End Set
End Property
Private _num_ordine As String = Nothing
Public Property num_ordine As String
Get
Return _num_ordine
End Get
Set(ByVal value As String)
_num_ordine = value
End Set
End Property
Private _inviato As Boolean = Nothing
Public Property inviato As Boolean
Get
Return _inviato
End Get
Set(ByVal value As Boolean)
_inviato = value
End Set
End Property
End Class
Public Class Corpo
Private _barcode As String = Nothing
Public Property barcode As String
Get
Return _barcode
End Get
Set(ByVal value As String)
_barcode = value
End Set
End Property
Private _desc As String = Nothing
Public Property desc As String
Get
Return _desc
End Get
Set(ByVal value As String)
_desc = value
End Set
End Property
Private _um As String = Nothing
Public Property um As String
Get
Return _um
End Get
Set(ByVal value As String)
_um = value
End Set
End Property
Private _qta As Single = Nothing
Public Property qta As Single
Get
Return _qta
End Get
Set(ByVal value As Single)
_qta = value
End Set
End Property
Private _id_testata As Integer = Nothing
Public Property id_testata As Integer
Get
Return _id_testata
End Get
Set(ByVal value As Integer)
_id_testata = value
End Set
End Property
Private _tipo_frontalino As String = Nothing
Public Property tipo_frontalino As String
Get
Return _tipo_frontalino
End Get
Set(ByVal value As String)
_tipo_frontalino = value
End Set
End Property
Private _timestamp As Long = Nothing
Public Property timestamp As Long
Get
Return _timestamp
End Get
Set(ByVal value As Long)
_timestamp = value
End Set
End Property
End Class
End Class
I'm pretty sure VB.NET didn't have auto-properties back then, so you will need to change your code to use the classic properties with a backing field. For example:
' Backing field
Private _cod As String = "Empty"
' Classic property getter and setter
Property cod As String
Get
Return _cod
End Get
Set(ByVal value As String)
_cod = value
End Set
End Property

How to get all json values with newtonsoft

I'm having a hard time getting through all the JSON values ​​of a string, can anyone help me?
I'm only getting a single value, where am I going wrong?
My codes
Dim address As String = "http://wsloterias.azurewebsites.net/api/sorteio/getresultado/1"
Dim client As WebClient = New WebClient()
Dim reader As StreamReader = New StreamReader(client.OpenRead(address))
Dim json = (reader.ReadToEnd)
Dim objs As RootObject = JsonConvert.DeserializeObject(Of RootObject)(json)
Dim objsSorteio As Sorteio = JsonConvert.DeserializeObject(Of Sorteio)(json)
For Each nums In objsSorteio.Premios
MsgBox(nums.ToString)
Next
Classes
Public Class Premio
Public Property Faixa() As String
Get
Return m_Faixa
End Get
Set(value As String)
m_Faixa = Value
End Set
End Property
Private m_Faixa As String
Public Property NumeroGanhadores() As Integer
Get
Return m_NumeroGanhadores
End Get
Set(value As Integer)
m_NumeroGanhadores = Value
End Set
End Property
Private m_NumeroGanhadores As Integer
Public Property Valor() As Double
Get
Return m_Valor
End Get
Set(value As Double)
m_Valor = Value
End Set
End Property
Private m_Valor As Double
End Class
Public Class Sorteio
Public Property NumSorteio() As Integer
Get
Return m_NumSorteio
End Get
Set(value As Integer)
m_NumSorteio = Value
End Set
End Property
Private m_NumSorteio As Integer
Public Property Numeros() As List(Of Integer)
Get
Return m_Numeros
End Get
Set(value As List(Of Integer))
m_Numeros = Value
End Set
End Property
Private m_Numeros As List(Of Integer)
Public Property Premios() As List(Of Premio)
Get
Return m_Premios
End Get
Set(value As List(Of Premio))
m_Premios = Value
End Set
End Property
Private m_Premios As List(Of Premio)
Public Property Ganhadores() As List(Of Object)
Get
Return m_Ganhadores
End Get
Set(value As List(Of Object))
m_Ganhadores = Value
End Set
End Property
Private m_Ganhadores As List(Of Object)
End Class
Public Class RootObject
Public Property NumeroConcurso() As Integer
Get
Return m_NumeroConcurso
End Get
Set(value As Integer)
m_NumeroConcurso = Value
End Set
End Property
Private m_NumeroConcurso As Integer
Public Property Acumulou() As Boolean
Get
Return m_Acumulou
End Get
Set(value As Boolean)
m_Acumulou = Value
End Set
End Property
Private m_Acumulou As Boolean
Public Property EstimativaPremio() As Double
Get
Return m_EstimativaPremio
End Get
Set(value As Double)
m_EstimativaPremio = Value
End Set
End Property
Private m_EstimativaPremio As Double
Public Property ValorAcumulado() As Double
Get
Return m_ValorAcumulado
End Get
Set(value As Double)
m_ValorAcumulado = Value
End Set
End Property
Private m_ValorAcumulado As Double
Public Property Data() As String
Get
Return m_Data
End Get
Set(value As String)
m_Data = Value
End Set
End Property
Private m_Data As String
Public Property RealizadoEm() As String
Get
Return m_RealizadoEm
End Get
Set(value As String)
m_RealizadoEm = Value
End Set
End Property
Private m_RealizadoEm As String
Public Property DescricaoAcumuladoOutro() As String
Get
Return m_DescricaoAcumuladoOutro
End Get
Set(value As String)
m_DescricaoAcumuladoOutro = Value
End Set
End Property
Private m_DescricaoAcumuladoOutro As String
Public Property ValorAcumuladoOutro() As Double
Get
Return m_ValorAcumuladoOutro
End Get
Set(value As Double)
m_ValorAcumuladoOutro = Value
End Set
End Property
Private m_ValorAcumuladoOutro As Double
Public Property DataProximo() As String
Get
Return m_DataProximo
End Get
Set(value As String)
m_DataProximo = Value
End Set
End Property
Private m_DataProximo As String
Public Property ValorAcumuladoEspecial() As Double
Get
Return m_ValorAcumuladoEspecial
End Get
Set(value As Double)
m_ValorAcumuladoEspecial = Value
End Set
End Property
Private m_ValorAcumuladoEspecial As Double
Public Property Arrecadacao() As Double
Get
Return m_Arrecadacao
End Get
Set(value As Double)
m_Arrecadacao = Value
End Set
End Property
Private m_Arrecadacao As Double
Public Property Sorteios() As List(Of Sorteio)
Get
Return m_Sorteios
End Get
Set(value As List(Of Sorteio))
m_Sorteios = Value
End Set
End Property
Private m_Sorteios As List(Of Sorteio)
End Class
I can not go through all the "Numeros" and also "Premios"
You are over complicating this unnecessarily.
using the URL provided the exposed json data was copied and plugged into a utility site like http://jsonutils.com/. It generated the models with auto properties. Note that it converted collections to array as apposed to Lists like you have in your classes.
Public Class Premio
Public Property Faixa As String
Public Property NumeroGanhadores As Integer
Public Property Valor As Double
End Class
Public Class Sorteio
Public Property NumSorteio As Integer
Public Property Numeros As Integer()
Public Property Premios As Premio()
Public Property Ganhadores As Object()
End Class
Public Class RootObject
Public Property NumeroConcurso As Integer
Public Property Acumulou As Boolean
Public Property EstimativaPremio As Double
Public Property ValorAcumulado As Double
Public Property Data As String
Public Property RealizadoEm As String
Public Property DescricaoAcumuladoOutro As String
Public Property ValorAcumuladoOutro As Double
Public Property DataProximo As String
Public Property ValorAcumuladoEspecial As Double
Public Property Arrecadacao As Double
Public Property Sorteios As Sorteio()
End Class
Basically the same as what you had originally with better readability. Feel free to convert tha arrays back to list if that is your preference.
The first desrialization is already giving you the necessary object. Drill into the properties in order to access the values you need.
'''other code removed for brevity
Dim objs As RootObject = JsonConvert.DeserializeObject(Of RootObject)(json)
Dim objsSorteioList As List(Of Sorteio) = objs.Sorteios.ToList()
For Each objsSorteio In objsSorteioList
For Each prems In objsSorteio.Premios
MsgBox(prems.ToString)
Next
For Each nums In objsSorteio.Numeros
MsgBox(nums.ToString)
Next
Next

How to add datas from one class to another

I have a problem and i don't know how to solve it.
I have 2 different classs, and i need to get a datas that are in fist class to another class.
My first class look like :
Public Class ZnrEk1Ospos
Private _sif_tvrtka As Integer
Private _sif_radnika As Integer
Private _red_broj As Integer
Private _sif_ovl_osobe As Integer
Private _datum_teorija As Date
Private _datum_praksa As Date
Private _prezime_ime As String
Private _strucna_sprema As String
Private _funkcija As String
Private _status_obrasca As Integer
Private _glavni_instruktor As Integer
Private _instruktor_prezime As String
Private _instruktor_sprema As String
Private _instruktor_funkcija As String
Private _evidencijski_broj As String
Private _potvrda As String
Public Sub New()
'Do nothing as all private variables has been initiated
End Sub
Public Sub New(ByVal DataRow As DataRow)
_sif_tvrtka = CInt(DataRow.Item("sif_tvrtka"))
_sif_radnika = CInt(DataRow.Item("sif_radnika"))
_red_broj = CInt(DataRow.Item("red_broj"))
_sif_ovl_osobe = CInt(DataRow.Item("sif_ovl_osobe"))
_datum_teorija = IIf(IsDBNull(DataRow.Item("datum_teorija")), Nothing, DataRow.Item("datum_teorija"))
_datum_praksa = IIf(IsDBNull(DataRow.Item("datum_praksa")), Nothing, DataRow.Item("datum_praksa"))
_prezime_ime = IIf(IsDBNull(DataRow.Item("prezime_ime")), "", Trim(DataRow.Item("prezime_ime")))
_strucna_sprema = IIf(IsDBNull(DataRow.Item("strucna_sprema")), "", Trim(DataRow.Item("strucna_sprema")))
_funkcija = IIf(IsDBNull(DataRow.Item("funkcija")), "", Trim(DataRow.Item("funkcija")))
_status_obrasca = CInt(DataRow.Item("status_obrasca"))
_glavni_instruktor = CInt(DataRow.Item("glavni_instruktor"))
_instruktor_prezime = IIf(IsDBNull(DataRow.Item("instruktor_prezime")), "", Trim(DataRow.Item("instruktor_prezime")))
_instruktor_sprema = IIf(IsDBNull(DataRow.Item("instruktor_sprema")), "", Trim(DataRow.Item("instruktor_sprema")))
_instruktor_funkcija = IIf(IsDBNull(DataRow.Item("instruktor_funkcija")), "", Trim(DataRow.Item("instruktor_funkcija")))
_evidencijski_broj = IIf(IsDBNull(DataRow.Item("evidencijski_broj")), "", Trim(DataRow.Item("evidencijski_broj")))
_potvrda = IIf(IsDBNull(DataRow.Item("potvrda")), "", Trim(DataRow.Item("potvrda").ToString))
End Sub
Public Property sif_tvrtka() As Integer
Get
Return _sif_tvrtka
End Get
Set(ByVal value As Integer)
_sif_tvrtka = value
End Set
End Property
Public Property sif_radnika() As Integer
Get
Return _sif_radnika
End Get
Set(ByVal value As Integer)
_sif_radnika = value
End Set
End Property
Public Property red_broj() As Integer
Get
Return _red_broj
End Get
Set(ByVal value As Integer)
_red_broj = value
End Set
End Property
Public Property sif_ovl_osobe() As Integer
Get
Return _sif_ovl_osobe
End Get
Set(ByVal value As Integer)
_sif_ovl_osobe = value
End Set
End Property
Public Property datum_teorija() As Date
Get
Return _datum_teorija
End Get
Set(ByVal value As Date)
_datum_teorija = value
End Set
End Property
Public Property datum_praksa() As Date
Get
Return _datum_praksa
End Get
Set(ByVal value As Date)
_datum_praksa = value
End Set
End Property
Public Property prezime_ime() As String
Get
Return _prezime_ime
End Get
Set(ByVal value As String)
_prezime_ime = value
End Set
End Property
Public Property strucna_sprema() As String
Get
Return _strucna_sprema
End Get
Set(ByVal value As String)
_strucna_sprema = value
End Set
End Property
Public Property funkcija() As String
Get
Return _funkcija
End Get
Set(ByVal value As String)
_funkcija = value
End Set
End Property
Public Property status_obrasca() As Integer
Get
Return _status_obrasca
End Get
Set(ByVal value As Integer)
_status_obrasca = value
End Set
End Property
Public Property glavni_instruktor() As Integer
Get
Return _glavni_instruktor
End Get
Set(ByVal value As Integer)
_glavni_instruktor = value
End Set
End Property
Public Property instruktor_prezime() As String
Get
Return _instruktor_prezime
End Get
Set(ByVal value As String)
_instruktor_prezime = value
End Set
End Property
Public Property instruktor_sprema() As String
Get
Return _instruktor_sprema
End Get
Set(ByVal value As String)
_instruktor_sprema = value
End Set
End Property
Public Property instruktor_funkcija() As String
Get
Return _instruktor_funkcija
End Get
Set(ByVal value As String)
_instruktor_funkcija = value
End Set
End Property
Public Property evidencijski_broj() As String
Get
Return _evidencijski_broj
End Get
Set(ByVal value As String)
_evidencijski_broj = value
End Set
End Property
Public Property potvrda() As String
Get
Return _potvrda
End Get
Set(ByVal value As String)
_potvrda = value
End Set
End Property
And my second class in wich i want go get data from my first class look like:
Public Class TempEK1OsposTeorija
Private _sif_ovl_osobe As Integer
Private _datum_teorija As Date
Private _datum_praksa As Date
Private _prezime_ime As String
Private _strucna_sprema As String
Now i need to get data in Public Class TempEK1OsposTeorija form class Public Class ZnrEk1Ospos.
Does anybody know how to do that?
You need to create a new instance of that class
Public Class TempEK1OsposTeorija
Private _sif_ovl_osobe As Integer
Private _datum_teorija As Date
Private _datum_praksa As Date
Private _prezime_ime As String
Private _strucna_sprema As String
Public sub PozoviKlasuIvratiPodatke()
' To use the word using you must implement the IDisposable Interface into first class
Using cl as new ZnrEk1Ospos
'get data from first class
_sif_ovl_osobe = cl._sif_ovl_osobe
_datum_teorija = cl._datum_teorija
_datum_praksa = cl._datum_praksa
_prezime_ime = cl._prezime_ime
_strucna_sprema = cl._strucna_sprema
End using
End sub
End class

IEquityComparer to '=' overloader

My question is for my general understanding, it is not a problem, following are demo classes from my project:
Public Class Registration
Inherits HumanBase
Private _NameeValue As HumanName
Property Namee As HumanName
Get
Return _NameeValue
End Get
Set(ByVal Value As HumanName)
If Not _NameeValue = Value Then
_NameeValue = Value
OnPropertyChanged("Namee")
End If
End Set
End Property
Private _UserPasswordValue As String
Public Property UserPassword() As String
Get
Return _UserPasswordValue
End Get
Set(ByVal value As String)
If Not _UserPasswordValue.Equals(value) Then
_UserPasswordValue = value
OnPropertyChanged("UserPassword")
End If
End Set
End Property
Private _UserEmailValue As String
Public Property UserEmail() As String
Get
Return _UserEmailValue
End Get
Set(ByVal value As String)
If Not _UserEmailValue = value Then
_UserEmailValue = value
OnPropertyChanged("UserEmail")
End If
End Set
End Property
Property UserPassword2 As String
End Class
Public Class HumanName
Inherits HumanBase
Implements IComparable(Of HumanName)
Implements IEqualityComparer(Of HumanName)
#Region "Private Variables"
Private _TitleNameValue As CommonTypes.TitleName
Private _FirstNameValue As String
Private _MiddleNameValue As String
Private _LastNameValue As String
Private _SuffixNameValue As CommonTypes.Suffixname
#End Region
#Region "Property Variables"
Property TitleName As CommonTypes.TitleName
Get
Return _TitleNameValue
End Get
Set(ByVal Value As CommonTypes.TitleName)
If Not _TitleNameValue = Value Then
_TitleNameValue = Value
OnPropertyChanged("TitleName")
End If
End Set
End Property
Property FirstName As String
Get
Return _FirstNameValue
End Get
Set(ByVal Value As String)
If Not _FirstNameValue = Value Then
_FirstNameValue = Value
OnPropertyChanged("FirstName")
End If
End Set
End Property
Property MiddleName As String
Get
Return _MiddleNameValue
End Get
Set(ByVal Value As String)
If Not _MiddleNameValue = Value Then
_MiddleNameValue = Value
OnPropertyChanged("MiddleName")
End If
End Set
End Property
Property LastName As String
Get
Return _LastNameValue
End Get
Set(ByVal Value As String)
If Not _LastNameValue = Value Then
_LastNameValue = Value
OnPropertyChanged("LastName")
End If
End Set
End Property
Property SuffixName As CommonTypes.Suffixname
Get
Return _SuffixNameValue
End Get
Set(ByVal Value As CommonTypes.Suffixname)
If Not _SuffixNameValue = Value Then
_SuffixNameValue = Value
OnPropertyChanged("SuffixName")
End If
End Set
End Property
#End Region
Public Function CompareTo(ByVal other As HumanName) As Integer Implements System.IComparable(Of HumanName).CompareTo
Return True
End Function
Public Function Equals1(ByVal x As HumanName, ByVal y As HumanName) As Boolean Implements System.Collections.Generic.IEqualityComparer(Of HumanName).Equals
Return True
End Function
Public Function GetHashCode1(ByVal obj As HumanName) As Integer Implements System.Collections.Generic.IEqualityComparer(Of HumanName).GetHashCode
Return True
End Function
End Class
The code errors out at coding time itself at "If Not _NameeValue = Value Then" and the error is Error Operator '=' is not defined for types 'SharesCommCodeLib.Human.HumanName' and 'SharesCommCodeLib.Human.HumanName'.
Could you please tell me why '=" is not working when I implemented both ICOMPAREABLE and IEquitableComparer. Would DotNet does not consider it for Operator Overloading.
Thank you.
i strongly recommend to set OPTION STRICT to ON, your code wouldn't even compile when you try to return a Boolean from a method which signature defines an Integer as return type. That helps to avoid errors
The IEqualityComparer Interface is used to define your own definition of equality and can be used wherever this interface is used to specify equality, for example in the constructors of Hashtable, NameValueCollection or OrderedDictionary
If you want to use the = operator on custom types you need to overload it:
Public Shared Operator =(ByVal humanName1 As HumanName, ByVal humanName2 As HumanName) As Boolean
Return humanName1._FirstNameValue.Equals(humanName2._FirstNameValue) AndAlso _
humanName1._MiddleNameValue.Equals(humanName2._MiddleNameValue) AndAlso _
humanName1._LastNameValue.Equals(humanName2._LastNameValue)
End Operator
Public Shared Operator <>(ByVal humanName1 As HumanName, ByVal humanName2 As HumanName) As Boolean
Return Not humanName1 = humanName2
End Operator

OData made from objects

Lets say I have a class called "Item" and "SubItems"
Public Class SubItem
Private _SubItemName As String
Public Property SubItemName() As String
Get
Return _SubItemName
End Get
Set(ByVal value As String)
_SubItemName = value
End Set
End Property
End Class
<DataServiceKey("Name")> _
Public Class Item
Private _Name As String
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
Private _SubItems As List(Of SubItem)
Public Property SubItems() As List(Of SubItem)
Get
Return _SubItems
End Get
Set(ByVal value As List(Of SubItem))
_SubItems = value
End Set
End Property
End Class
How would I create a service that would return a list of Items and upon looking up an individual item I would be able to see the sub items.
You can check out WCF Data Servies reflection provider, e.g.,
http://blogs.msdn.com/b/alexj/archive/2010/06/11/tip-56-writing-an-odata-service-using-the-reflection-provider.aspx
http://msdn.microsoft.com/en-us/library/dd728281.aspx
Hope this helps.