Quantcast
Viewing all articles
Browse latest Browse all 256

[RESOLVED] Unable to cast object of type 'System.Collections.Generic.List`1[System.String]' to t

Unable to cast object of type 'System.Collections.Generic.List`1[System.String]' to type 'WindowsApplication1.ServiceReferenceVSAPI.ArrayOfString'.
What is going on here? I cannot find a simple viable solution on Google.

Here is my WCF class:
Code:

Namespace MyTypes
    <DataContract(), KnownType(GetType(List(Of String))), XmlSerializerFormat()>
    <Serializable()>
    Public Class setorder
        <DataMember()>
        Public Property LoyaltyUserName() As String
            Get
                Return m_LoyaltyUserName
            End Get

            Set(value As String)
                m_LoyaltyUserName = value
            End Set
        End Property
        <DataMember()>
        Private m_LoyaltyUserName As String
        <DataMember()>
        Public Property LoyaltyPassword() As String
            Get
                Return m_LoyaltyPassword
            End Get
            Set(value As String)
                m_LoyaltyPassword = value
            End Set
        End Property
        <DataMember()>
        Private m_LoyaltyPassword As String

        <DataMember()>
        Public Property seats As List(Of String)
            Get
                Return m_seats
            End Get
            Set(value As List(Of String))
                m_seats = value
            End Set
        End Property
        <DataMember()>
        Private m_seats As List(Of String)
    End Class
End Namespace

here is the client code:
Code:

Dim vsetorder As New ServiceReferenceVSAPI.setorder       
        vsetorder.LoyaltyPassword = "asd"
        vsetorder.LoyaltyUserName = "g"
        Dim seats As New List(Of String)
        seats.Add("3")



        vsetorder.seats = seats

And i get the error on the vsetorder.seats = seats line.

I have tried every single model change on the wcf service (i thing system.collection.generic list is the most proper?) i have added and remove xml serialization features

alover and nothing works?

Any help?

P.S. I could care less if i use a list of or an arraylist but nothing works

Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>