CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    May 2012
    Posts
    27

    [Help] With <List>

    Hi
    to briefly explain what I'm trying to do, is the following:
    1 user creates a group, and the 2nd joins the specified group.

    My problem is that the Count is off, I'm doing something wrong obviously. Here is some code snippits
    So this is the actual function.
    Code:
    public class Groups
        {
            public User _User{ get; set; }
            public List<User> Users { get; set; }
    
           public Group(User user) {
    			_User = user;
                            Users = new List<User>();
    		}
    So this is where it gets used
    Code:
    Group group = new Group(user)
    case 1: //Create Group
    group.Users.Add(user);
    int eg = party.mUsers.Count();
    Console.WriteLine("Users" + eg);
                        break;
                    case 2: //Join Group
                        group.Users.Add(user);
                        int eg = party.mUsers.Count();
    Console.WriteLine("Users" + eg);
                        break;
    To explain a bit more, I have a Client - Server connection and there is two clients connected to the server. Case 1 is "user 1" (client 1) creating a group, and Case 2 is "user 2" (client 2) joining the group. Now, the problem is that the count is always 0. Why is this? how do I fix this?
    Thanks.
    Last edited by wutang001; August 2nd, 2012 at 01:34 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured