안녕하세요 배열을 일반 목록으로 변환 할 때 문제가 있습니다. 아래와 같이 오류가 발생했습니다. 수업에서 이미 ToList로 돌아 왔지만 왜 아직도 나타나지는 않습니다. 이미 서비스 참조 형식을 generic 목록으로 변경하는 것은 기본적으로 Array이지만 System.Collection.GenericList는 System.Collection.Genericlist로 변환 할 수 없습니다. 제발 도와주세요 감사합니다배열을 제네릭 목록으로 변환 할 수 없습니다.
Public Function GetMerchantList() As List(Of Merchant) Implements IMerchant.GetMerchantList
Dim ws As New aMerchantService.MerchantServiceClient
Dim General As New General
Dim kWSUrl As String = ""
Dim endpointAddress = ws.Endpoint.Address
Dim newEndpointAddress As New EndpointAddressBuilder(endpointAddress)
kWSUrl = General.ConvertWsURL("App")
newEndpointAddress.Uri = New Uri(kWSUrl & "MerchantService.svc")
ws = New aMerchantService.MerchantServiceClient("BasicHttpBinding_IMerchantService", newEndpointAddress.ToEndpointAddress())
Dim Data = ws.GetMerchantList()
Return Data
End Function
상인 클래스
Public Function GetMerchantList() As List(Of Merchant)
Dim Db As New TTMSEntities
Dim Data = (From p In Db.TT_MERCHANT Join r In Db.TT_BRANCH_SETTING On _
p.MERCHANT_BRANCH_INTERNAL_NUM Equals r.INTERNAL_NUM _
Select New Merchant With {.MerchantID = p.MERCHANT_ID,
.MerchantName = p.DESCRIPTION,
.BranchID = r.INTERNAL_NUM,
.BranchName = r.BRANCH_DESC})
If Data IsNot Nothing Then
Return Data.ToList
' Return ConvertMerchant(Data.ToList)
Else
Return Nothing
End If
End Function
오류
The error is Error Value of type '1-dimensional array of TTMS.App.WebSites.Data.Merchant' cannot be converted to 'System.Collections.Generic.List(Of TTMS.Web.WebSites.WCF.Merchant)'.
이 문제가있다 : 첫째로, 당신은 반환 할 수있는'T []'배열 방법은'(T의) 목록을 반환 선언 할 때 '. 두 번째 : '상인'클래스 네임 스페이스가 다릅니다. – MarcinJuraszek
'TTMS.App.WebSites.Data.Merchant'는'TTMS.Web.WebSites.WCF.Merchant'와 같지 않습니다. –
'ws.GetMerchantList()'에 대한 코드를 게시하십시오. –