Reputation: 245
I get the following error Class 'PropGenie_WebService.Branch' cannot be indexed because it has no default property.
And I am not sure why. I have googled but don't get a proper explanation or fix. C# help welcome.
My code in the branch.vb class:
Public Function Update() As Branch
Return Update(Me, Path) 'error at update.
End Function
And in my Base class (Resources.vb) I have:
Public Shared Function Update(Of T As {Resources, New})(resource As T, path As String) As T
Dim request = CreateRequest(path & "/{id}", Method.PATCH)
request.AddUrlSegment("id", resource.Id.ToString(CultureInfo.InvariantCulture))
request.AddBody(resource)
Dim Client = CreateClient()
Dim responce = Client.Execute(Of T)(request)
If responce.StatusCode <> HttpStatusCode.OK Then
Throw New InvalidOperationException("Update Failed" & Convert.ToString(responce.StatusCode))
End If
Return responce.Data
End Function
Upvotes: 4
Views: 7627
Reputation: 46977
You need to specify the class in which the shared function is also, or it will try to use the Update
function in the object you are in.
Public Function Update() As Branch
Return Resources.Update(Me, Path)
End Function
Upvotes: 2