title: Is a method which is not valid in the given context
body: <p><strong>My Code:</strong></p>
  
  <pre><code>public ChatServer()
          {
              //create our nickname and nickname by connection variables
              nickName = new Hashtable(100);
              nickNameByConnect = new Hashtable(100);
              //create our TCPListener object
              chatServer = new System.Net.Sockets.TcpListener(4296);
              //check to see if the server is running
              //while (true) do the commands
              while (true)
              {
                  chatServer.Start();
                  if (chatServer.Pending())
                  {
                      Chat.Sockets.TcpClient chatConnection = chatServer.AcceptTcpClient();
                      Console.WriteLine("You Are Connected");
                      DoCommunicate com = new DoCommunicate(chatConnection);
                  }
              }
          }
  
      public static void SendMsgToAll(string nick, string msg)
      {
  
          StreamWriter writer;
          ArrayList remove = new ArrayList(0);
          Chat.Sockets.TcpClient[] tcpClient = new Chat.Sockets.TcpClient[ChatServer.nickName.Count];
          ChatServer.nickName.Values.CopyTo(tcpClient, 0);
  </code></pre>
  
  <p>As from my above code, we can see that there are 2-methods i- ChatServer ii- SendMsgToAll.
  So when I try to write line <code>Chat.Sockets.TcpClient[] tcpClient = new Chat.Sockets.TcpClient[ChatServer.nickName.Count];</code> in the second method</p>
  
  <p>It gives the following error : </p>
  
  <p><strong>ChatSerevr() is a method which is not valid in the given context</strong>.</p>
  
  <p>I google it but unable to find the corrrect solution. Thanks in advance</p>