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

  • Home
  • SEARCH
  • 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 940187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:54:49+00:00 2026-05-15T21:54:49+00:00

A project I’m working on requires me to solve the following problem for a

  • 0

A project I’m working on requires me to solve the following problem for a simulation program:

The program pulls from sql 2 separate distinct lists. As an example I’ll use “Employees” and “Tasks”. We then programmatically assign anywhere from 0-2 “Employees” per “Task”. Each employee can be assigned to more then one task, but some tasks may require multiple employees and some tasks may go unassigned.

This all happens at the C# level and wont be stored back to sql, after the assignments the program resolves the simulation by resolving the results of individual assignments, stores results and runs the next set of lists.

I don’t need to manage lists beyond a size of 10-15 max, but need a solution efficient enough that a can batch run several thousand sims with out the assignment solution getting in the way.

I have quite a bit of flexibility, since at this point the objects are simply listitems direct from sql.

(I’m not a professional programmer so this might be obvious, or impossible)

  • 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-05-15T21:54:49+00:00Added an answer on May 15, 2026 at 9:54 pm

    This is easily done using generics.

        public class Employee
        {
            public string EmployeeName;
            public string EmployeeID;
        }
    
        public class Task
        {
            public string TaskName;
            public List<Employee> EmployeeList = new List<Employee>();
        }
    
        public void TestTaskList()
        {
            // list of tasks.
            List<Task> m_TaskList = new List<Task>();
            // create a new task.
            Task oFirstTask = new Task { TaskName = "First Task" };
            // add this task to your list
            m_TaskList.Add(oFirstTask);
            // loop through your tasks.
            foreach( Task oTask in m_TaskList) {
                if (oTask.EmployeeList.Count() == 0) 
                    // there are no employees, so add one
                    oTask.EmployeeList.Add(
                        new Employee { EmployeeName = "mschietinger" }
                        );
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Project Euler problem 14: The following iterative sequence is defined for the set of
The project I am working on requires some executions to be done at a
Every project invariably needs some type of reporting functionality. From a foreach loop in
A project I'm working on at the moment involves refactoring a C# Com Object
Project CompetitionServer.exe raised exception class ESQLiteException with message 'Error executing SQL. Error [1]: SQL
Project I'm working on uses jQuery. I have a series of Ajax calls being
Project Euler I have recently begun to solve some of the Project Euler riddles.
Project being built on ASP.net v 2 VB.net IIS 6 SQL Server 2005 database
Project Euler has a paging file problem (though it's disguised in other words). I
Project file here if you want to download: http://files.me.com/knyck2/918odc So I am working on

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.