Click here to Skip to main content
15,740,731 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all out there! I have this code below and I get the error: public readonly property count as integer' has no parameters and its return type cannot be indexed. Don't know what's wrong with the Count. Any help will be much appreciate, thanks.



VB
Public Sub Connect(userName As String)
            Dim id = Context.ConnectionId


            If ConnectedUsers.Count(Function(x) x.ConnectionId = id) = 0 Then
                ConnectedUsers.Add(New UserDetail() With { _
                    .ConnectionId = id, _
                    .UserName = userName _
                })

                ' send to caller
                Clients.Caller.onConnected(id, userName, ConnectedUsers, CurrentMessage)

                ' send to all except caller client

                Clients.AllExcept(id).onNewUserConnected(id, userName)
            End If

        End Sub
Posted
Comments
[no name] 14-Jul-13 10:00am    
http://stackoverflow.com/questions/14072058/vb-count-strange-behavior

1 solution

Probably, what you want to say is:
VB
If ConnectedUsers.Where(Function(x) x.ConnectionId = id).Count = 0 Then
 
Share this answer
 
Comments
[no name] 14-Jul-13 10:00am    
Thanks OriginalGriff, your response was fast. I marked it as answered but LongCount worked perfectly, will try where if I run across any issue again. Once again, thank you.
OriginalGriff 14-Jul-13 10:16am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900