Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:21:10+00:00 2026-06-08T09:21:10+00:00

I currently have the following code for my hub class: public class MatchMaker :

  • 0

I currently have the following code for my hub class:

public class MatchMaker : Hub
    {    


    private List<SoloUser> soloUsers = new List<SoloUser>();

    //Client Requests
    public void findNewPartner(string Country, string State)
    {
        SoloUser soloUser = soloUsers.FirstOrDefault(s => (s.Country== Country) && (s.State == State));
        if (soloUsers.Count > 0)
            Clients.partnerRequestResult(soloUsers.FirstOrDefault());
        else
        {
            soloUser = new SoloUser { 
                Major = Major,
                School = School,
                SessionId = SessionId,
                Token = token
            };
            soloUsers.Add(soloUser);
        }



    }
}

The problem is whenever I call this method on the client side, adding a SoloUser object to my soloUsers collection does not save, so when another user calls this function again, the linq statement(soloUsers.FirstOrDefault(s => (s.School == School) && (s.Major == Major))) never finds a SoloUser. How can I make it so my soloUsers collection will save the instance and the objects added to it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:21:12+00:00Added an answer on June 8, 2026 at 9:21 am

    SignalR creates a new hub instance for every call you make (which is something very lightweight, don’t worry about that), therefore your soloUsers list is not persisted between calls.

    Make the list static to solve this. Beware that this will need some sort of locking when accessing the list or use one of the concurrent collections to make it thread safe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have the following code: public class Count { public static void countChar()
I currently have the following code for java. public class lesson8 { static Console
I currently have code that does the following: private final static ExecutorService pool =
I currently have the following code: import argparse parser = argparse.ArgumentParser(description='Adds a new modem
I currently have the following code: <form action=process.php method=POST> <fieldset class=form-search> <input type=text class=input-text
I currently have the following code: public MyObject SessionStore { get { if (Session[MyData]
I currently have the following code: <ul id=menu-list> <a href=index.php> <li>Home</li> </a> <li><a href=about.php>About</a></li>
I currently have the following code: <%@ WebService Language=C# Class=Notifications %> using System; using
I currently have the following code: string user = @DOMAIN\USER; string[] parts = user.Split(new
I currently have the following code coming from a database table: <h1 class=widgetHeader>My Friends</h1>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.