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
Related
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
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
I am download a Json libary here : http://www.pozzware.com/pozzware/Corsi/Programmazione/VB.NET/JSON%20Library.aspx
This is my class on my project :
Imports PW.JSON
Public Class Prova
Private _id As Integer
Private _name As String
Private _valido As Boolean
Private _subObject As Prova
Private _numero As Integer
Private _numeroDec As Double
Private _array() As String
Public Property ID() As Integer
Get
Return _id
End Get
Set(ByVal value As Integer)
_id = value
End Set
End Property
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
Public Property Valido() As Boolean
Get
Return _valido
End Get
Set(ByVal value As Boolean)
_valido = value
End Set
End Property
Public Property SubObject() As Prova
Get
Return _subObject
End Get
Set(ByVal value As Prova)
_subObject = value
End Set
End Property
Public Property NumeroDec() As Double
Get
Return _numeroDec
End Get
Set(ByVal value As Double)
_numeroDec = value
End Set
End Property
Public Property Array() As String()
Get
Return _array
End Get
Set(ByVal value As String())
_array = value
End Set
End Property
Public Sub New(ByVal ID As Integer, ByVal Name As String)
_id = ID
_name = Name
End Sub
Public Function SomeMethod() As String
Return "Method: " & _id
End Function
End Class
And this is my code :
Sub PasteJsonExam()
Dim strJSON As String = "{""NumeroDec"": 100.34, ""Name"": ""Nome Object"", " & _
" ""Array"": [""A"", ""E"", ""I"", ""O"", ""U""], " & _
" ""SubObject"": {""NumeroDec"": 0, ""Name"": ""Nome - SubObject"", " & _
" ""Array"": null, ""SubObject"": null, ""Valido"": false, ""ID"": 2}, " & _
" ""Valido"": true, ""ID"": 1}"
Dim objprova As Prova
objprova = PW.JSON.JSONHelper.StringToObject(strJSON, GetType(Prova))
MsgBox(objprova.Name)
MsgBox(objprova.SubObject.Name)
End Sub
When i call that sub i got error :
No parameterless constructor defined for this object.
At this line :
objprova = PW.JSON.JSONHelper.StringToObject(strJSON, GetType(Prova))
I am not an professonal in VB.net so i hope someone explain for me why i got that error and how can i fix this.
Probably StringToObject method try to create an instance of Prova. It does this by calling the default(parameterless) constructor of the type.
But in the class you defined there isn't any parameterless constructor, you have only:
Public Class Prova
' Other fields and methods
Public Sub New(ByVal ID As Integer, ByVal Name As String)
_id = ID
_name = Name
End Sub
' Other fields and methods
End Class
To let the method work you need to define a parameterless constructor like:
Public Class Prova
' Other fields and methods
Public Sub New()
End Sub
Public Sub New(ByVal ID As Integer, ByVal Name As String)
_id = ID
_name = Name
End Sub
' Other fields and methods
End Class
Well i think that the library you are using is not the best choice, but, if you want to run your program you must add a default constructor (a constructor without parameter). That's because the library probably uses Reflection
This is the class with the Default Constructor:
Imports PW.JSON
Public Class Prova
Private _id As Integer
Private _name As String
Private _valido As Boolean
Private _subObject As Prova
Private _numero As Integer
Private _numeroDec As Double
Private _array() As String
Public Property ID() As Integer
Get
Return _id
End Get
Set(ByVal value As Integer)
_id = value
End Set
End Property
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
Public Property Valido() As Boolean
Get
Return _valido
End Get
Set(ByVal value As Boolean)
_valido = value
End Set
End Property
Public Property SubObject() As Prova
Get
Return _subObject
End Get
Set(ByVal value As Prova)
_subObject = value
End Set
End Property
Public Property NumeroDec() As Double
Get
Return _numeroDec
End Get
Set(ByVal value As Double)
_numeroDec = value
End Set
End Property
Public Property Array() As String()
Get
Return _array
End Get
Set(ByVal value As String())
_array = value
End Set
End Property
' This is the default constructor the library should need'
Public Sub New()
End Sub
Public Sub New(ByVal ID As Integer, ByVal Name As String)
_id = ID
_name = Name
End Sub
Public Function SomeMethod() As String
Return "Method: " & _id
End Function
End Class
I have a class that inherits from the CollectionBase and when adding items I want to detect whether the collection already contains the key that is going to be inserted. If it does I want to send a warning via a MsgBox(). Here is the code & what I've tried
<Serializable()> Public Class validationList
Inherits CollectionBase
Public Function Add(ByVal Item As validationItem) As Integer
MsgBox(Me.List.Contains(Item))
Return Me.List.Add(Item)
End Function
Default Public ReadOnly Property Item(ByVal index As Integer) As validationItem
Get
Return CType(List.Item(index), validationItem)
End Get
End Property
Public Sub Remove(ByVal index As Integer)
Me.List.RemoveAt(index)
End Sub
Public Function IndexOf(ByVal key As validationItem)
Return List.IndexOf(key)
End Function
Public Sub AddRange(ByVal item() As validationItem)
For counter As Integer = 0 To item.GetLength(0) - 1
List.Add(item(counter))
Next
End Sub
End Class
<Serializable()> Public Class validationItem
Private _key As validationTypes
Private _value As String
Public Enum validationTypes
man = 0
num = 1
End Enum
Public Property Value As String
Get
Return _value
End Get
Set(ByVal Value As String)
_value = Value
End Set
End Property
Public Property Key As validationTypes
Get
Return _key
End Get
Set(ByVal value As validationTypes)
_key = value
End Set
End Property
Public Sub New()
' Empty constructor is needed for serialization
End Sub
Public Sub New(ByVal k As validationTypes, ByVal v As String)
_key = k
_value = v
End Sub
End Class
Public Class textbox
Inherits System.Windows.Forms.TextBox
Private _validation As New validationList
<System.ComponentModel.DesignerSerializationVisibility(Content)>
Public Property validation As validationList
Get
Return _validation
End Get
Set(ByVal value As validationList)
_validation = value
End Set
End Property
End Class
In the add method I tried to check whether the collection already has this item. But it always returns -1.
Here is code that adds a new item to the collection
Textbox1.validation.Add(New validationItem With {.Key = validationItem.validationTypes.man, .Value = "1"})
To make Contains work, you'll have to implement Equals/GetHashCode on validationItem or implement the IEquatable(Of T) interface:
This method determines equality by using the default equality comparer, as defined by the object's implementation of the IEquatable(Of T).Equals method for T (the type of values in the list).
Here's an example implementation for Equals/GetHashCode that checks both, Key and Value:
<Serializable> _
Public Class validationItem
Protected Overloads Function Equals(other As validationItem) As Boolean
Return _value = other._value AndAlso _key = other._key
End Function
Public Overrides Function Equals(obj As Object) As Boolean
If obj Is Nothing Then
Return False
End If
If Me Is obj Then
Return True
End If
If obj.GetType() IsNot Me.GetType() Then
Return False
End If
Return Equals(DirectCast(obj, validationItem))
End Function
Public Overrides Function GetHashCode() As Integer
Return ((If(_value IsNot Nothing, _value.GetHashCode(), 0)) * 397) Xor CInt(_key)
End Function
...
End Class
You could also use use LINQ, here's an example that only checks for Key:
Public Function Add(ByVal Item As validationItem) As Integer
If Me.List.OfType(Of validationItem).Any(Function(i) i.Key = Item.Key) Then
' Do something '
Else
Return Me.List.Add(Item)
End If
End Function
You need to just check for whether the key exist or not and only show it if it exists:
Public Function Add(ByVal Item As validationItem) As Integer
If Me.List.Contains(Item) Then MsgBox("The key already exists")
Return Me.List.Add(Item)
End Function
As it stands you are just returning the result of the Contains method which is a Boolean (hence the -1)
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